Re: [Haskell-cafe] Re: Libraries for Commercial Users
IMHO, the software industry is no driven by workforce or by stocked stuff like libraries. It is driven by ideas. People with ideas tend to use the tools that materialize these ideas in their free time faster and better, with joy and beauty, It comes to my mind the first Jazz players that invented a new tradition, choose to play sax and trumpets because these instruments were easier to learn, small, very expressive, portable and brighting. Sometimes a long tradition of doing things in a certain way is an obstacle for innovation. If you think that Haskell can not compete with the tons of boring stuff for doing the same boring applications then you missed the point ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal probems with binary/containers packages
On Tue, 2009-10-27 at 21:37 -0700, brian wrote: It all started with this: Loading package binary-0.5.0.1 ... can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) so I tried cabal upgrade binary Don't do that. Just use cabal install binary. Upgrade means install the named package and also try to install the latest version of all of its dependencies. That's generally not a good idea. It's choosing to upgrade your containers package and you probably do not want to do that. We're thinking about how to changing the behaviour of upgrade so that you can upgrade the dependencies you want without also upgrading the ones that you really wanted to be kept the same (like the core or perhaps even the platform libs). Building containers-0.2.0.1... Data/IntMap.hs:182:7: Could not find module `Data.Data': it is a member of package base, which is hidden This is because the containers packages doesn't say that it needs base version 4. In fact it doesn't say what version it needs at all. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal haddock hpc, exposed modules?
On Tue, 2009-10-27 at 14:33 -0700, Greg Fitzgerald wrote: my Setup.hs includes an explicit system call to hpc: exec hpc [markup , --include=Language.Idl.Data , --include=Language.Idl.Merge , --include=Language.Idl.Parser ...all the same files as above... ] Why do you want to explicitly specify hpc --include=blah for every module? By default hpc markup will generate pages for every module in the program. Am I missing something? Questions: 1) Is there a way to create haddock docs for /all/ modules, instead of just the ones listed by 'exposed-modules'? Yes $ cabal haddock --help [...] --executables Run haddock for Executables targets --internal Run haddock for internal modules and include all symbols [...] This is also documented in the Cabal user guide. 2) Is there a way to query cabal for the list of modules? Or by chance has hpc recently been integrated with cabal? Certainly it'd be nice to have more direct support for making a hpc flavour build using cabal. There's an open ticket on that feature request. But I don't think it's that hard at the moment. I use hpc with cabal frequently. Just cabal build --ghc-option=-fhpc. The only thing you have to watch out for is if you've got multiple executables in the .cabal file since the files that hpc writes out for the Main modules clash with each other. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: Libraries for Commercial Users
I'm absolutely missing your point. Here's an example. I'm a commercial developer. I need to create an SNMP agent. You show me Haskell, I point at Erlang. Erlang wins for time to market, and Haskell doesn't get to be part of the solution. We need libraries. On Wed, Oct 28, 2009 at 2:44 AM, Alberto G. Corona agocor...@gmail.comwrote: IMHO, the software industry is no driven by workforce or by stocked stuff like libraries. It is driven by ideas. People with ideas tend to use the tools that materialize these ideas in their free time faster and better, with joy and beauty, It comes to my mind the first Jazz players that invented a new tradition, choose to play sax and trumpets because these instruments were easier to learn, small, very expressive, portable and brighting. Sometimes a long tradition of doing things in a certain way is an obstacle for innovation. If you think that Haskell can not compete with the tons of boring stuff for doing the same boring applications then you missed the point ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal probems with binary/containers packages
Hi Duncan, That works just fine: Installing library in /Users/briand/.cabal/lib/binary-0.5.0.2/ghc-6.10.1 Registering binary-0.5.0.2... Reading package info from dist/installed-pkg-config ... done. Writing new package config file... done. and still ghc gives me: Loading package binary-0.5.0.1 ... can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) The question, of course, is to figure out why ghc is trying to load the old version. I know binary isn't dynamically linked, because ghc works unless I'm trying to use the binary package. Is there something broken in the 0.5.0.2 release that causes ghc to look for the old library ? Brian On Oct 28, 2009, at 4:00 AM, Duncan Coutts wrote: On Tue, 2009-10-27 at 21:37 -0700, brian wrote: It all started with this: Loading package binary-0.5.0.1 ... can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) so I tried cabal upgrade binary Don't do that. Just use cabal install binary. Upgrade means install the named package and also try to install the latest version of all of its dependencies. That's generally not a good idea. It's choosing to upgrade your containers package and you probably do not want to do that. We're thinking about how to changing the behaviour of upgrade so that you can upgrade the dependencies you want without also upgrading the ones that you really wanted to be kept the same (like the core or perhaps even the platform libs). Building containers-0.2.0.1... Data/IntMap.hs:182:7: Could not find module `Data.Data': it is a member of package base, which is hidden This is because the containers packages doesn't say that it needs base version 4. In fact it doesn't say what version it needs at all. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal probems with binary/containers packages
Just found the following file: .ghc/powerpc-darwin-6.10.1/pkg-config and it is referring to 0.5.0.1. Is there anyway to regenerate the file, or is it broken because of a problem with the package ? Thanks, Brian On Oct 28, 2009, at 4:00 AM, Duncan Coutts wrote: On Tue, 2009-10-27 at 21:37 -0700, brian wrote: It all started with this: Loading package binary-0.5.0.1 ... can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) so I tried cabal upgrade binary Don't do that. Just use cabal install binary. Upgrade means install the named package and also try to install the latest version of all of its dependencies. That's generally not a good idea. It's choosing to upgrade your containers package and you probably do not want to do that. We're thinking about how to changing the behaviour of upgrade so that you can upgrade the dependencies you want without also upgrading the ones that you really wanted to be kept the same (like the core or perhaps even the platform libs). Building containers-0.2.0.1... Data/IntMap.hs:182:7: Could not find module `Data.Data': it is a member of package base, which is hidden This is because the containers packages doesn't say that it needs base version 4. In fact it doesn't say what version it needs at all. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Cabal says no installed version of base
On Tue, Oct 27, 2009 at 09:28:39AM +, Duncan Coutts wrote: On Wed, 2009-10-21 at 16:05 -0700, John Velman wrote: I'm on OS X Leopard 10.5.8, using ghc 6.10.4 from Haskell Platform. I'm trying to get a static .a library, callable from C, that I can use in an OS X Cocoa program. I've tried a very simple case (the one in Haskell Wiki Tutorials,calling haskell from C) I've managed to make a Mac Cocoa application by adding the ghc generated .o program, plus adding one by one the needed Haskell libraries for symbol not found to my Xcode project. There should be a better way. I've tried just about everything I could find on creating Haskell libraries, with no joy. My latest try is to use Cabal, following advice found both in How to write a Haskell program and the Cabal users guide. My output from cabal -v configure tells me, among others: Is that the full command you ran? No other flags or arguments? I'm assuming you're using cabal-install version 0.6.2. I checked results that I kept, and that was the full command. As I recall, ghc-pkg didn't report any problem, but I don't recall whether or not it listed in {}'s. After posting this message, (and waiting for a while), I tinkered considerably with my installation without any better results. I then uninstalled, and reinstalled Haskell Platform. I then went back to documenting what I actually did to get a working Cocoa with Haskell function program running. I'll try to redo the cabal version of library creation carefully, and check the things you mention below, after I finish my documentation of my Cocoa with Haskell test case. Thanks, John V. According to the source it only produces that error in response to a top level constraint passed on the command line. It internally adds such a dependency, to make sure the solver never tries to pick a version of base from hackage. The problem could be that your base package is broken (missing dependencies) and thus the constraint on an installed base cannot be satisfied. When you run ghc-pkg list base, does it list it in {}'s? Does ghc-pkg check report any problems? Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] uu-parsinglib pKeyword
Hi everybody, I am using the uu-parsinglib to parse a structured language and map the results to some proper data structures. Thanks to Prof Doaitse Swierstra (and other authors if any), it is fun to write a parser using this library. I've been sending private mails to Doaitse about my questions, who kindly gives nice replies everytime. But this time I thought I can ask my question to the community, and give everyone the chance to benefit from the answers. [After the intro, here comes my real question] I am trying to capture the following pattern. pKeyword_Int = ( \ _ _ _ - int ) $ pSym 'i' * pSym 'n' * pSym 't' pKeyword_Float = ( \ _ _ _ _ _ - float ) $ pSym 'f' * pSym 'l' * pSym 'o' * pSym 'a' * pSym 't' As you can see there is an obvious pattern if you try to capture a keyword. If there were a function called pKeyword taking a string as an argument and producing the necessary parser, things would be easier. What I mean is, pKeyword_Int = pKeyword int pKeyword_Float = pKeyword float I tried to create this pKeyword function myself but I couldn't manage to do it. I can feel that, one can simply add a * pReturn [] to the ends of every parser and write a recursion with this base condition. Any suggestions? PS: Actually I'm a little bit uncomfortable since there may be such a function in the library already :) -- Ozgur Akgun ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: uu-parsinglib pKeyword
pToken [] = pSucceed [] pToken (x:xs) = (:) $ pSym x * pToken xs pKeyword_Float = pToken Float etc Doaitse PS: this function has been defined in the module Text.ParserCombinators.UU.Derived On 28 okt 2009, at 17:39, Ozgur wrote: Hi everybody, I am using the uu-parsinglib to parse a structured language and map the results to some proper data structures. Thanks to Prof Doaitse Swierstra (and other authors if any), it is fun to write a parser using this library. I've been sending private mails to Doaitse about my questions, who kindly gives nice replies everytime. But this time I thought I can ask my question to the community, and give everyone the chance to benefit from the answers. [After the intro, here comes my real question] I am trying to capture the following pattern. pKeyword_Int = ( \ _ _ _ - int ) $ pSym 'i' * pSym 'n' * pSym 't' pKeyword_Float = ( \ _ _ _ _ _ - float ) $ pSym 'f' * pSym 'l' * pSym 'o' * pSym 'a' * pSym 't' As you can see there is an obvious pattern if you try to capture a keyword. If there were a function called pKeyword taking a string as an argument and producing the necessary parser, things would be easier. What I mean is, pKeyword_Int = pKeyword int pKeyword_Float = pKeyword float I tried to create this pKeyword function myself but I couldn't manage to do it. I can feel that, one can simply add a * pReturn [] to the ends of every parser and write a recursion with this base condition. Any suggestions? PS: Actually I'm a little bit uncomfortable since there may be such a function in the library already :) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: uu-parsinglib pKeyword
On Wed, Oct 28, 2009 at 06:07:49PM +0100, S. Doaitse Swierstra wrote: pToken [] = pSucceed [] pToken (x:xs) = (:) $ pSym x * pToken xs pKeyword_Float = pToken Float pToken = traverse pSym ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal haddock hpc, exposed modules?
Duncan wrote: By default hpc markup will generate pages for every module in the program. Am I missing something? Nope, user error. I started using --include to avoid running coverage over my test framework files, and was looking for something like haddock's internal flag before thinking to just delete all the --include lines. Nothing means something didn't occur to me. Thanks! Duncan wrote: $ cabal haddock --help [...] --executables Run haddock for Executables targets --internal Run haddock for internal modules and include all symbols [...] Great! Looks like these docs are new to 2.4.x. $ haddock --version Haddock version 2.3.0, (c) Simon Marlow 2006 Ported to use the GHC API by David Waern 2006-2008 $ haddock --help | grep internal $ Thanks for your help Duncan. -Greg ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Re: uu-parsinglib pKeyword
One of the parser combinator libraries for Clean had the (:) combinator that captures the idiom (sorry!) in Doaitse's version. Defined applicatively it would be: (:) :: Applicative f = f a - f [a] - f [a] (:) p1 p2 = (:) $ p1 * p2 so pToken would be pToken [] = pSucced [] pToken (x:xs) = pSym x : pToken xs Admittedly this is not as succinct as pToken = traverse pSym ... but I have used it from time to time. Regards, Stephen 2009/10/28 Ross Paterson r...@soi.city.ac.uk: On Wed, Oct 28, 2009 at 06:07:49PM +0100, S. Doaitse Swierstra wrote: pToken [] = pSucceed [] pToken (x:xs) = (:) $ pSym x * pToken xs pKeyword_Float = pToken Float pToken = traverse pSym ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: uu-parsinglib pKeyword
Even though it was nice to see how it can be implemented, I'll be using the PS version :) I was really close in implementing it myself. Anyway thanks for the quick reply. 2009/10/28 S. Doaitse Swierstra doai...@cs.uu.nl pToken [] = pSucceed [] pToken (x:xs) = (:) $ pSym x * pToken xs pKeyword_Float = pToken Float etc Doaitse PS: this function has been defined in the module Text.ParserCombinators.UU.Derived On 28 okt 2009, at 17:39, Ozgur wrote: Hi everybody, I am using the uu-parsinglib to parse a structured language and map the results to some proper data structures. Thanks to Prof Doaitse Swierstra (and other authors if any), it is fun to write a parser using this library. I've been sending private mails to Doaitse about my questions, who kindly gives nice replies everytime. But this time I thought I can ask my question to the community, and give everyone the chance to benefit from the answers. [After the intro, here comes my real question] I am trying to capture the following pattern. pKeyword_Int = ( \ _ _ _ - int ) $ pSym 'i' * pSym 'n' * pSym 't' pKeyword_Float = ( \ _ _ _ _ _ - float ) $ pSym 'f' * pSym 'l' * pSym 'o' * pSym 'a' * pSym 't' As you can see there is an obvious pattern if you try to capture a keyword. If there were a function called pKeyword taking a string as an argument and producing the necessary parser, things would be easier. What I mean is, pKeyword_Int = pKeyword int pKeyword_Float = pKeyword float I tried to create this pKeyword function myself but I couldn't manage to do it. I can feel that, one can simply add a * pReturn [] to the ends of every parser and write a recursion with this base condition. Any suggestions? PS: Actually I'm a little bit uncomfortable since there may be such a function in the library already :) -- Ozgur Akgun ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: uu-parsinglib pKeyword
And of course thanks for all the other replies and versions. This mailing list is *really* active! 2009/10/28 Ozgur Akgun ozgurak...@gmail.com Even though it was nice to see how it can be implemented, I'll be using the PS version :) I was really close in implementing it myself. Anyway thanks for the quick reply. 2009/10/28 S. Doaitse Swierstra doai...@cs.uu.nl pToken [] = pSucceed [] pToken (x:xs) = (:) $ pSym x * pToken xs pKeyword_Float = pToken Float etc Doaitse PS: this function has been defined in the module Text.ParserCombinators.UU.Derived On 28 okt 2009, at 17:39, Ozgur wrote: Hi everybody, I am using the uu-parsinglib to parse a structured language and map the results to some proper data structures. Thanks to Prof Doaitse Swierstra (and other authors if any), it is fun to write a parser using this library. I've been sending private mails to Doaitse about my questions, who kindly gives nice replies everytime. But this time I thought I can ask my question to the community, and give everyone the chance to benefit from the answers. [After the intro, here comes my real question] I am trying to capture the following pattern. pKeyword_Int = ( \ _ _ _ - int ) $ pSym 'i' * pSym 'n' * pSym 't' pKeyword_Float = ( \ _ _ _ _ _ - float ) $ pSym 'f' * pSym 'l' * pSym 'o' * pSym 'a' * pSym 't' As you can see there is an obvious pattern if you try to capture a keyword. If there were a function called pKeyword taking a string as an argument and producing the necessary parser, things would be easier. What I mean is, pKeyword_Int = pKeyword int pKeyword_Float = pKeyword float I tried to create this pKeyword function myself but I couldn't manage to do it. I can feel that, one can simply add a * pReturn [] to the ends of every parser and write a recursion with this base condition. Any suggestions? PS: Actually I'm a little bit uncomfortable since there may be such a function in the library already :) -- Ozgur Akgun -- Ozgur Akgun ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal probems with binary/containers packages
On Wed, 2009-10-28 at 07:07 -0700, brian wrote: Just found the following file: .ghc/powerpc-darwin-6.10.1/pkg-config and it is referring to 0.5.0.1. Is there anyway to regenerate the file, or is it broken because of a problem with the package ? It all started with this: Loading package binary-0.5.0.1 ... can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) What's (probably) going on is that you deleted the files for the binary-0.5.0.1 package but did not unregister it. You probably also have other registered packages that depend on binary-0.5.0.1 (because that's the version they were built against). You can use ghc-pkg to forcibly unregister binary-0.5.0.1 and rebuild the other packages that depended on it. Generally I recommend just leaving old packages and rebuilding things when necessary (which cabal-install will do automatically) rather than going about deleting or unregistering older versions of packages. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal haddock hpc, exposed modules?
On Wed, 2009-10-28 at 10:43 -0700, Greg Fitzgerald wrote: Duncan wrote: $ cabal haddock --help [...] --executables Run haddock for Executables targets --internal Run haddock for internal modules and include all symbols [...] Great! Looks like these docs are new to 2.4.x. $ haddock --version Haddock version 2.3.0, (c) Simon Marlow 2006 Ported to use the GHC API by David Waern 2006-2008 $ haddock --help | grep internal Note the command I gave was cabal haddock not haddock. The cabal one calls haddock with the modules in the .cabal file (and other info like the package name, version and description). If what you wanted was to call haddock directly then you can list the modules you like on the command line. It's usually easier to use the cabal wrapper however since it passes all the flags to get links to other packages which otherwise you have to list manually. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] C headers in cabal dependencies
Hi, I've been using 'install-includes' in a package. I sometimes make small changes to those include files, and I've seen that cabal doesn't consider then dependencies, i.e., doesn't rebuild .hsc files depending on then. I'm not sure if this is an error, as parsing hsc2hs input may not be cabal task. Anyway, I would like to suggest that files in install-includes be considered dependencies and that files under 'includes' be also included when processing '.hsc' files. Thanks. Best, Maurício ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] What *is* a DSL?
On 22 okt 2009, at 15:56, Robert Atkey wrote: Previously parsed input /can/ determine what the parser will accept in the future (as pointed out by Peter Ljunglöf in his licentiate thesis). Consider the following grammar for the context-sensitive language {aⁿbⁿcⁿ| n ∈ ℕ}: Yes, sorry, I was sloppy in what I said there. Do you know of a characterisation of what languages having a possibly infinite amount of nonterminals gives you. Is it all context-sensitive languages or a subset? The answer is: all context-sensitive languages. This is a very old insight which has come back in various forms in computer science. The earliest conception in CS terms is the concept of an affix-grammar, in which the infinite number of nonterminals is generated by parameterising non-terminals by trees. They were invented by Kees koster and Lambert Meertens (who applied them to generate music: http://en.wikipedia.org/wiki/index.html?curid=5314967) in the beginning of the sixties of the last century. There is a long follow up on this idea, of which the two most well-known versions are the so-called two-level grammars which were used in the Algol68 report and the attribute grammar formalism first described by Knuth. The full Algol68 language is defined in terms of a two-level grammar. Key publications/starting points if you want to learn more about these are: - the Algol68 report: http://burks.brighton.ac.uk/burks/language/other/a68rr/rrtoc.htm - the wikipedia paper on affix grammars: http://en.wikipedia.org/wiki/Affix_grammar - a nice book about the basics od two-level grammars is the Cleaveland Uzgalis book, Grammars for programming languages, which may be hard to get, but there is hope: http://www.amazon.com/Grammars-Programming-Languages-languages/dp/0444001875 - http://www.agfl.cs.ru.nl/papers/agpl.ps - http://comjnl.oxfordjournals.org/cgi/content/abstract/32/1/36 Doaitse Swierstra And a general definition for parsing single-digit numbers. This works for any set of non-terminals, so it is a reusable component that works for any grammar: Things become more complicated if the reusable component is defined using non-terminals which take rules (defined using an arbitrary non-terminal type) as arguments. Exercise: Define a reusable variant of the Kleene star, without using grammars of infinite depth. I see that you have an answer in the paper you linked to above. Another possible answer is to consider open sets of rules in a grammar: data OpenRuleSet inp exp = forall hidden. OpenRuleSet (forall a. (exp :+: hidden) a - Rule (exp :+: hidden :+: inp) a) data (f :+: g) a = Left2 (f a) | Right2 (g a) So OpenRuleSet inp exp, exports definitions of the nonterminals in 'exp', imports definitions of nonterminals in 'inp' (and has a collection of hidden nonterminals). It is then possible to combine them with a function of type: combineG :: (inp1 := exp1 :+: inp) - (inp2 := exp2 :+: inp) - OpenRuleSet inp1 exp1 - OpenRuleSet inp2 exp2 - OpenRuleSet inp (exp1 :+: exp2) One can then give a reusable Kleene star by stating it as an open rule set: star :: forall a nt. Rule nt a - OpenRuleSet nt (Equal [a]) where Equal is the usual equality GADT. Obviously, this would be a bit clunky to use in practice, but maybe more specialised versions combineG could be given. Bob -- The University of Edinburgh is a charitable body, registered in Scotland, with registration number SC005336. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] simple parsing
Ok, I think this is a weird problem, but let us start. You want to parse a sequence of operands separated by an operator (we assume the ops are left associative): import Text.ParserCombinators.UU.Parsing pWeird = pChainl pOperator pOperand An operand is apparently a non-empty list of digits, and the result should be the last of these digits: pOperand = toList.last $ pList1 (pSym ('0', '9')) toList x = [x] An operator is a sequence of +-/* symbols, and it is the first element in which you are interested: pOperator = intoOp.head $ pList1 (pSym '+' | pSym '-' ...) The function intoOp now builds the function which constructs the final list given the operator and the left and right operands: intoOp op = \leftop rightop - leftop ++ [op] ++ rightop Doaitse On 27 okt 2009, at 23:38, satorisanitarium wrote: I'm trying to parse a list of numbers plus four diferent signs (+-*/) in this way: Lets say the list is 32+5/46 result would be 2+5/4 I get: 2+5/4*** Exception: geneticSimple.hs:(55,0)-(65,35): Non-exhaustive patterns in function chromoResult If the list is 32+5**6 result would be 2+5*6 I get: 2+5/*** Exception: geneticSimple.hs:(55,0)-(65,35): Non-exhaustive patterns in function chromoResult If the list is 32+-72 resoult would be 2+7 I get: 2+*** Exception: geneticSimple.hs:(55,0)-(65,35): Non-exhaustive patterns in function chromoResult code: chromoResult [] = [] chromoResult (a:b:c:xs) | elem a 0123456789 elem b 0123456789 elem c 0123456789 = chromoResult (c:xs) | elem a 0123456789 elem b 0123456789 elem c +-*/ = b:c: chromoResult xs | elem a 0123456789 elem b +-*/ elem c 0123456789 = a:b:c : chromoResult xs | elem a 0123456789 elem b +-*/ elem c +-*/ = a:b : chromoResult (c:xs) | elem a +-*/ elem b 0123456789 elem c 0123456789 = chromoResult (b:c:xs) | elem a +-*/ elem b 0123456789 elem c +-*/ = b:c : chromoResult xs | elem a +-*/ elem b +-*/ elem c 0123456789 = chromoResult (c:xs) | elem a +-*/ elem b +-*/ elem c +-*/ = chromoResult xs | otherwise = chromoResult (b:c:xs) I suspect my approach is flawed but i have exausted my ideas. I need a fresh approach so if anybody would be kind enough and just give me a hint how to approach the problem. Thx in advance. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Re: frag game - compilation fixes
I've hacked through (senselessly) the various compilation errors (I think they were all related to GLfloat vs. Float, etc.) Frag now compiles and works, but I think I may have introduced some bugs (the weapon doesn't appear on the screen?) Unfortunately, I did the whole job on an unpacked cabal package from hackage, and also I've never used darcs. So here's the resulting package tree (excluding the big files). If anyone knows how to turn it into a darcs working copy and create a patch from it, please do! (The attachment is available at http://www.haskell.org/pipermail/haskell-cafe/attachments/20091028/884ff469/frag-1.1.2b.tar-0001.gz ) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] cabal probems with binary/containers packages
That was indeed the problem. I edited the pkg-config file by hand. I followed your advice anyway and unregistered and re-installed. Everythingworks now. Thanks for your help. Brian On Oct 28, 2009, at 11:58 AM, Duncan Coutts wrote: On Wed, 2009-10-28 at 07:07 -0700, brian wrote: Just found the following file: .ghc/powerpc-darwin-6.10.1/pkg-config and it is referring to 0.5.0.1. Is there anyway to regenerate the file, or is it broken because of a problem with the package ? It all started with this: Loading package binary-0.5.0.1 ... can't load .so/.DLL for: HSbinary-0.5.0.1 (dlopen(libHSbinary-0.5.0.1.dylib, 9): image not found) What's (probably) going on is that you deleted the files for the binary-0.5.0.1 package but did not unregister it. You probably also have other registered packages that depend on binary-0.5.0.1 (because that's the version they were built against). You can use ghc-pkg to forcibly unregister binary-0.5.0.1 and rebuild the other packages that depended on it. Generally I recommend just leaving old packages and rebuilding things when necessary (which cabal-install will do automatically) rather than going about deleting or unregistering older versions of packages. Duncan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Finally tagless and ghc-extensions
Hi all, ok, I haven't let go on the EDSL subject just yet. I'm still digesting the Finally Tagless approach from Oleg, Jacques and Chen. In both, the JFP APLAS paper, the authors note that no fancy type extension are needed for this approach. But in almost every (Haskell) example that is a bit more involved the authors do make use of functional dependencies and / or type families. GADTs are also being used, although *not* in the syntax definition but merely in the semantic instances, I'm cool with that :) . I haven't touched base yet with either functional dependencies nor type families as I understand the edges on neither are yet worked out, so I'd prefer being able to avoid either when using the tagless approach even in more involved settings. Is that possible? Günther ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe