News aggregator

Imperative Reasoning is Hard

Haskell on Reddit - Fri, 12/27/2013 - 10:24am
Categories: Incoming News

www.glc.us.es

del.icio.us/haskell - Fri, 12/27/2013 - 12:45am
Categories: Offsite Blogs

integrating Happy & Alex monads

haskell-cafe - Thu, 12/26/2013 - 10:08pm
I'm working on a program in which I'd like to use Alex and Happy to parse the input. I've written the scanner, and it uses Alex's "monadUserState" wrapper to track source location and various other things. Now, the problem is to integrate it with the parser. As far as I can tell from reading the Happy documentation, I need to use a monadic Parser in Happy as well, but the manuals don't relaly provide a lot of information about how to integrate the two. And I haven't really been able to find many examples of this either. Lots of folks cite "the Haskell parser", although I'm not sure which implementation that's referring to. I did check out the GHC source, and while it contains an Alex parser specification, it doesn't look like anything actually *uses* this, preferring instead a handwritten parser. Could anyone point me to a discussion of how to integrate these two tools, or examples of places where folks have done this before? Thanks much, Richard
Categories: Offsite Discussion

All About Monads - HaskellWiki

del.icio.us/haskell - Thu, 12/26/2013 - 8:05pm
Categories: Offsite Blogs

GHC

del.icio.us/haskell - Thu, 12/26/2013 - 8:04pm
Categories: Offsite Blogs

cabal sandboxes executable path

libraries list - Thu, 12/26/2013 - 7:35pm
Hi! After I do `cabal install`, I get two binaries: - in `dist/dist-sandbox-$ID/build/Foo/Foo` - in `.cabal-sandbox/bin/Foo` They seem to be different. Is this ok? Which one of them is the right one? Sorry if I missed this in docs. Thanks. _______________________________________________ Libraries mailing list Libraries< at >haskell.org http://www.haskell.org/mailman/listinfo/libraries
Categories: Offsite Discussion

Top-down inserts in Persistent

haskell-cafe - Thu, 12/26/2013 - 7:17pm
I'm loading data from XML into a Haskell data type, and I'd like to use Persistent to save it to a database. The examples from the Yesod book have you manually define a FooId field and create the relationships yourself from the bottom up. For example, "a person has many cars": blah blah [persistLowerCase| Person name String Car ownerId PersonId Eq name String |] This works well if you're responsible for creating every person/car manually. But what if the data are given to you? If I were to parse people from an XML file, the cars wouldn't have people_ids in them. Instead I'd get, blah blah [persistLowerCase| Person name String cars [Car] Car name String |] As long as the cars list contains another Persistent type, it seems like I should be able to insert a person and have it insert the cars, with proper foreign keys, automatically. Doing it manually isn't straight-forward because I can't add the "ownerId" field to my Car type and still expect to
Categories: Offsite Discussion

parametrized data types and Template Haskell

haskell-cafe - Thu, 12/26/2013 - 1:36pm
Dear Cafe, Hope you all had a nice Christmas. I have been playing with generating method instances using Template Haskell but am a bit stuck now trying to generate an instance for a parametrized data type. I would like to generate the following: > instance (MyClass a) => MyClass (Tree a) where > mymethod _ = "todo" I defined a genMyClassInstance that is working fine for unparametrized data types, but clearly there is nothing here that inserts the '(MyClass a) =>' part here. My first question is: how should I instruct Template Haskell to insert the beforementioned code when appropriate? > genMyClassInstance :: Name -> Q [Dec] > genMyClassInstance name > = [d|instance MyClass $(conT name) where > mymethod _ = "todo" > |] My second question is how to pass the Name of a parametrized data type? I tried the following, but GHC does not seem to like that: "Not in scope: type constructor or class `Tree a' Perhaps you meant `Tree'" > $(genMyInstance (mkName
Categories: Offsite Discussion

mainisusuallyafunction.blogspot.ru

del.icio.us/haskell - Thu, 12/26/2013 - 12:45pm
Categories: Offsite Blogs

(automatically) adding import statements in vim

haskell-cafe - Wed, 12/25/2013 - 1:45pm
Are there any tools or vim-plugins that will automatically add import statements? For instance, I have the following code: ... import Data.Maybe (fromJust) import Text.ParserCombinators.Parsec (ParseError) import Text.Printf (printf) ... parseMyString :: String -> Either ParseError String parseMyString stringToParse = parse myParser "(unknown)" stringToParse Here's what I want to have happen. I put my cursor over "parse" and press some keystroke. It automatically adds the parse function to the list of import statements from the Text.ParserCombinators.Parsec module (hopefully sorted alphabetically). So the import statements end up looking like this: ... import Data.Maybe (fromJust) import Text.ParserCombinators.Parsec (ParseError, parse) import Text.Printf (printf) ... The haskellmode vim plugin (https://github.com/lukerandall/haskellmode-vim) has functionality similar to this, but it can only add new import lines. It can't add functions/types to existing import lines. The best it can do is some
Categories: Offsite Discussion

Parse HTML that is contain javascript

haskell-cafe - Tue, 12/24/2013 - 9:03pm
Hi, I am Akira. I want to parse HTML file that is contain javascript. But I cant come up with how to deal with script tag. Is there anyone help me? Details of probrem HTML code I want to parse is like following <html> <script> //<![CDATA[ <!-- --> //]]> </script> </html> Because '<' is used as normal character in the script region, I can not use my HTML parser there. _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe< at >haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Categories: Offsite Discussion

Munich Haskell Holiday Meeting

haskell-cafe - Tue, 12/24/2013 - 12:37pm
Dear all, I want to announce a special holiday meeting of Munich's Haskell user group. It will take place on the 27th of December at 19h30 at Cafe Puck. Check out the details here: http://www.haskell-munich.de/news I wish everyone a nice holiday! Heinrich
Categories: Offsite Discussion

forever function laziness

haskell-cafe - Tue, 12/24/2013 - 4:02am
Hello, guys. Recently I came across the definition of the function 'forever' on hoogle. I am intrigued that it works. The recursive definition does make sense to me in a mathematical way, but I can't figure out how it works under the hood in terms of thunks. To tell you the truth, I don't know how laziness works in general in haskell. Can someone help me understand how it works in this example, and give some pointers to materials on the subject? The "tying the knot" article on the wiki is pretty mind bending too.
Categories: Offsite Discussion

hslogger and metalog compatibility

haskell-cafe - Mon, 12/23/2013 - 11:20pm
Is anyone else using metalog (syslog implementation) along with hslogger to log to syslog? If I run the following with syslog-ng, it works. With metalog, I get nothing. Just want to make sure it isn't me before I report it. Prelude> :set prompt "ghci> " ghci> :m +System.Log.Logger ghci> :m +System.Log.Handler.Syslog ghci> sl <- openlog rootLoggerName [] USER DEBUG ghci> updateGlobalLogger rootLoggerName (addHandler sl) ghci> errorM rootLoggerName "This won't show up with metalog."
Categories: Offsite Discussion