On Thu, Jan 19, 2012 at 15:02, Edward Z. Yang <ezyang@mit.edu> wrote:
Oleg has described a grody hack which achieves this effect.

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

I agree more first class support for this would be nice.

Edward

That's an amusing hack, but does it provide anything on top of `asTypeOf`? I'd rather write Oleg's first example as,

isOrd :: Ord a => a
isOrd = undefined
asOrd = flip asTypeOf isOrd

f x = Just $ asOrd x
-- now has type Ord a => a -> Maybe a

Actually, using view patterns, one can get closer to the code I wanted to write,

f (asOrd -> x) = Just x

comp x = do
    (asOrd -> y) <- return x
    return y

But, ideally, I want type expressions to appear as types, not value functions.