RE: Type families and type inference - a question

2010-01-11 Thread Simon Peyton-Jones
...@haskell.org] On Behalf Of Yitzchak Gale | Sent: 10 January 2010 19:41 | To: Dmitry Tsygankov | Cc: glasgow-haskell-users | Subject: Re: Type families and type inference - a question | | Daniel Fischer wrote: | (Note: Surprisingly (?), if you load a module with | {-# LANGUAGE NoMonomorphismRestriction

Type families and type inference - a question

2010-01-10 Thread Dmitry Tsygankov
Dear all, I was playing around recently with translating the dependency injection idea (http://martinfowler.com/articles/injection.html) into Haskell, and got to the following code: {-# LANGUAGE TypeFamilies, FlexibleContexts #-} data Movie = Movie { getDirector :: String } data (MovieFinder

Re: Type families and type inference - a question

2010-01-10 Thread Bulat Ziganshin
Hello Dmitry, Sunday, January 10, 2010, 7:09:33 PM, you wrote: -- Cannot remove the type signature here createLister :: (MovieFinder f) = (FinderResultMonad f) (MovieLister f) createLister = fmap MovieLister createFinder it's a Monomorphism Restriction of Haskell'98, disabled with

Re: Type families and type inference - a question

2010-01-10 Thread Dmitry Tsygankov
Oh, I see... Thank you, it works now with NoMonomorphismRestriction. The error message is extremely misleading though... And so is the type signature inferred by the compiler. 2010/1/10 Bulat Ziganshin bulat.zigans...@gmail.com it's a Monomorphism Restriction of Haskell'98, disabled with

Re: Type families and type inference - a question

2010-01-10 Thread Daniel Fischer
Am Sonntag 10 Januar 2010 17:09:33 schrieb Dmitry Tsygankov: Dear all, I was playing around recently with translating the dependency injection idea (http://martinfowler.com/articles/injection.html) into Haskell, and got to the following code: {-# LANGUAGE TypeFamilies, FlexibleContexts #-}

Re: Type families and type inference - a question

2010-01-10 Thread Yitzchak Gale
Daniel Fischer wrote: (Note: Surprisingly (?), if you load a module with {-# LANGUAGE NoMonomorphismRestriction #-} , the monomorphsm restriction is still enabled at the ghci prompt, so we have to disable it for that again - or we could have loaded the module with $ ghci

Re: Type families and type inference - a question

2010-01-10 Thread Daniel Fischer
Am Montag 11 Januar 2010 05:08:30 schrieb Dmitry Tsygankov: 2010/1/10 Yitzchak Gale IMHO, the monomorphism restriction does not make sense at the GHCi prompt in any case, no matter what you have or haven't loaded, and no matter what your opinion of MR in general. Looks reasonable to me,