[Haskell-cafe] Re: Type wildcards

ChrisK haskell at list.mightyreason.com
Tue Dec 16 10:44:26 EST 2008


You can get pretty far with the same trick oleg mentions at [1].

If you use local type signature then you can do things like this:

> {-
> ghci infers this type:
> *Main> :t f
> f :: (Ord a) => Int -> a -> t -> String
> -}
> f i j x | False = (undefined (i::Int) (isOrd j)) :: String
> f i j x = error "not filled in"
> 
> isOrd :: Ord a => a -> ()
> isOrd = undefined
> 

Cheers,
   Chris

[1] http://okmij.org/ftp/Haskell/types.html#partial-sigs



More information about the Haskell-Cafe mailing list