Re: [Haskell-cafe] Strange Type Inference

2007-11-06 Thread Henning Thielemann
On Mon, 5 Nov 2007, C.M.Brown wrote: > I was given a quandary this evening, suppose I have the following code: Did you already try Prelude's 'asTypeOf' function? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/list

Re: [Haskell-cafe] Strange Type Inference

2007-11-05 Thread C.M.Brown
> I get: > > Test1.hs:6:34: parse error on input `=>' > > Is the syntax incorrect? Scrap that, I forgot to enable the glasgow extensions. It's been a long day. *sigh* :) Chris. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.

Re: [Haskell-cafe] Strange Type Inference

2007-11-05 Thread C.M.Brown
> Yes, using a ghc extension of scoped type variables. In the signature > of testFunction, if you explicitly quantify all your variables with > forall, then they are visible in the where clause (and elsewhere in > the function). Perfect! But how come if I have: testFunction :: forall a b. Ord a

Re: [Haskell-cafe] Strange Type Inference

2007-11-05 Thread Robin Green
On Mon, 5 Nov 2007 21:37:16 + (GMT) "C.M.Brown" <[EMAIL PROTECTED]> wrote: > Is there a way to give lookup0 and lookup1 explicit type signatures > without passing in m0 and m1 as parameters? (So their definitions are > the same as in the first example) If ghc can infer the type, surely > it mu

Re: [Haskell-cafe] Strange Type Inference

2007-11-05 Thread Luke Palmer
On Nov 5, 2007 2:37 PM, C.M.Brown <[EMAIL PROTECTED]> wrote: > Hi, > > I was given a quandary this evening, suppose I have the following code: > > module Test1 where > > import qualified Data.Map as Map > > testFunction :: Ord a => Map.Map a b -> Map.Map a b -> a -> (Maybe b, > Maybe b) > testFunct

[Haskell-cafe] Strange Type Inference

2007-11-05 Thread C.M.Brown
Hi, I was given a quandary this evening, suppose I have the following code: module Test1 where import qualified Data.Map as Map testFunction :: Ord a => Map.Map a b -> Map.Map a b -> a -> (Maybe b, Maybe b) testFunction m0 m1 k = (lookup0 k, lookup1 k) where