Re: question about GHC API on GHC plugin

2015-08-22 Thread Ömer Sinan Ağacan
I have a new question: I'm working on supporting literals now. I'm having trouble creating something that looks like `(App (Var F#) (Lit 1.0))` because I don't know how to create a variable that corresponds to the `F#` constructor. The mkWiredInName function looks promising, but overly

How is this Generic-based instance implementation optimized by GHC?

2015-08-22 Thread Ömer Sinan Ağacan
Hi all, I'm very confused by an optimization GHC is doing. I have this code: data Tree a = Leaf a | Branch (Tree a) (Tree a) deriving (Generic, Show, NFData) data Tree1 a = Leaf1 a | Branch1 (Tree1 a) (Tree1 a) deriving (Show) instance NFData a = NFData (Tree1 a) where

Re: How is this Generic-based instance implementation optimized by GHC?

2015-08-22 Thread José Pedro Magalhães
Hi there, GHC can often do a pretty good job at optimising generics. I wrote a paper that looks at that in detail: José Pedro Magalhães. Optimisation of Generic Programs through Inlining. In 24th Symposium on Implementation and Application of Functional Languages (IFL'12), 2013.

Re: Request for input on #7253: Top-level bindings in GHCI

2015-08-22 Thread Andrew Gibiansky
I would suggest treating a = 1 as a declaration. This is what IHaskell does, and it seems more intuitive than hacky parsing it into a let a = 1. The implementation should be easy using runDecls from InteractiveEval and parseDeclaration from Parser.y to do the actual parsing. -- Andrew On Sat,

Re: How is this Generic-based instance implementation optimized by GHC?

2015-08-22 Thread Ömer Sinan Ağacan
Awesome, thanks for the pointer, Pedro. 2015-08-22 19:01 GMT-04:00 José Pedro Magalhães drei...@gmail.com: Hi there, GHC can often do a pretty good job at optimising generics. I wrote a paper that looks at that in detail: José Pedro Magalhães. Optimisation of Generic Programs through

Request for input on #7253: Top-level bindings in GHCI

2015-08-22 Thread Alex Rozenshteyn
I'm thinking of working on this ticket ( https://ghc.haskell.org/trac/ghc/ticket/7253), so, as per mpickering's suggestion (https://phabricator.haskell.org/chatlog/channel/3/?at=1353572), I'm emailing the list to solicit input. My first instinct was to treat declarations like a = 1 in GHCI as

Access to class defaults and derived instances

2015-08-22 Thread David Feuer
From time to time, a library lacks an instance for something that I want. For example, I may need to convert data Foo = Bar (Vector Baz) to FishFood, but (to avoid unreasonable dependencies) Vector doesn't have a ToFishFood instance, so I can't just write instance ToFishFood Foo and (using