RE: higher-order typing errors

2003-01-23 Thread Simon Peyton-Jones
Because GHC does not allow you to instantiate a polymorphic type variable with a polymorphic type. For example, you can have Maybe Int Maybe (Int - Int) but not Maybe (forall a. a-a) The Maybe type is defined thus data Maybe b = Nothing | Just b so the type

Re: higher-order typing errors

2003-01-23 Thread Tomasz Zielonka
Hi! On Thu, Jan 23, 2003 at 10:28:13AM -, Simon Peyton-Jones wrote: To get around it, define your own data type: data MyPr = MyPr (forall a.a-a) (forall a.a-a) swap1 :: MyPr - MyPr I played a bit with using highed order polymorphism for this problem, and have encountered

RE: higher-order typing errors

2003-01-23 Thread Simon Peyton-Jones
| The first version doesn't compile - the error is: | Type synonym `F3' should have 1 argument, but has been given 0 | In the type: Pair F3 F2 | While checking the type signature for `p' Type synonyms in Haskell must be saturated (i.e. given all their argments). GHC lifts this restriction