Untypeable Haskell 98

From HaskellWiki
Revision as of 00:40, 29 August 2006 by NeilMitchell (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
module Test where

f :: a -> a
f x = g x
     where
--      g :: a -> a
        g y = bind x y

bind :: a -> a -> a
bind a b = a

The above Haskell code is Haskell 98, rank-1 types, but cannot be given a type signature. Try commenting out the type signature for g and everything will go wrong.

In GHC making the type of f :: forall a . a -> a, and adding -fglasgow-exts will make this code work. No such luck in Hugs.