[Haskell-cafe] Specifying a function type in a where clause.

2008-09-18 Thread Rob deFriesse
I would like to know why I'm getting a particular compile time error message. In this program, I am specifying a function type on /combs'/ in the where clause: module Main where import List (delete) combs :: Eq a = [a] - Int - [[a]] combs l 1 = map (\x - [x]) l combs l n = foldl

Re: [Haskell-cafe] Specifying a function type in a where clause.

2008-09-18 Thread Daniel Fischer
Am Freitag, 19. September 2008 00:33 schrieb Rob deFriesse: I would like to know why I'm getting a particular compile time error message. In this program, I am specifying a function type on /combs'/ in the where clause: module Main where import List (delete) combs :: Eq a =

Re: [Haskell-cafe] Specifying a function type in a where clause.

2008-09-18 Thread Ryan Ingram
The Haskell98 solution is to use asTypeOf to document types in helper functions combs' acc x = let sl = delete (x `asTypeOf` head l) l in ... Using ScopedTypeVariables is much nicer, though. -- ryan On Thu, Sep 18, 2008 at 3:55 PM, Daniel Fischer [EMAIL PROTECTED] wrote: Am Freitag, 19.

Re: [Haskell-cafe] Specifying a function type in a where clause.

2008-09-18 Thread Ryan Ingram
Also, in Haskell98 you can also use this hack to document coerce the typechecker: combs' acc x | const False (acc `asTypeOf` [l]) = undefined `asTypeOf` [l] combs' acc x | const False (x `asTypeOf` head l) = undefined combs' acc x = ... definition as before The compiler should remove the const