Ting Lei <[email protected]> writes:
> (f1, f2) =
> let commond_definitions = undefined in
> let f1 = id.show
> f2 x = (< x)
> in
> (f1, f2)
I think the type signatures should be:
f1 :: Show a => a -> String
and
f2 :: Ord b => b -> b -> Bool
When I define these separately, this works:
f1 :: Show a => a -> String
f1 = id . show
f2 :: Ord b => b -> b -> Bool
f2 = flip (<)
But when I define them as a pair
f1 :: Show a => a -> String
f2 :: Ord b => b -> b -> Bool
(f1,f2) = (id . show, flip (<))
I get an error message:
Line 9: 1 error(s), 0 warning(s)
Couldn't match expected type `forall a. Show a => a -> String'
with actual type `a -> String'
When checking that `f1'
has the specified type `forall a1. Show a1 => a1 -> String'
Defining the pair at once works:
p :: (Show a, Ord b) => (a -> String, b -> b -> Bool)
p = (id . show, flip (<))
I guess that didn't help a lot, somebody with deeper GHC-fu than me will
have to step in.
-k
--
If I haven't seen further, it is by standing in the footprints of giants
_______________________________________________
Haskell-Cafe mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/haskell-cafe