Local evidence and type class instances

Antoine Latter aslatter at gmail.com
Sat Oct 16 10:52:24 EDT 2010


On Sat, Oct 16, 2010 at 7:11 AM, Max Bolingbroke
<batterseapower at hotmail.com> wrote:
> Hi GHC users,
>
> Now that the Glorious New type checker can handle local evidence
> seamlessly, is it a big implementation burden to extend it to deal
> with local *type class instances* in addition to local *equality
> constraints*?
>
> For example, you could write this:
>
> """
> f :: Bool
> f = id < id
>  where
>   instance Ord (a -> b) where
>     _ `compare` _ = LT
> """
>

Along similar lines as my last post, would I be able to write the
following type signature:

myFunct :: Ord Int => Int -> (...)

and have it always use the local instance for Ord Int? Is this the
type that the type checker would infer for my function?

Antoine


More information about the Glasgow-haskell-users mailing list