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 reasonabl

Re: Type families and type inference - a question

2010-01-10 Thread 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, that's why I intuitively expected let q = fmap MovieLister create

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 -XNoMonomorphismR

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, FlexibleConte

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 > it's a Monomorphism Restriction of Haskell'98, disabled with > -XNoMonomorphismRestriction >

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 -XNoM

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 f)