Skip to content

Instantly share code, notes, and snippets.

View ahammar's full-sized avatar

Andreas Hammar ahammar

View GitHub Profile
@ahammar
ahammar / gist:1019376
Created June 10, 2011 18:01
Constrained associated type
{-# LANGUAGE TypeFamilies, FlexibleContexts #-}
class Xyzzy a where
xyzzy :: a -> Int
class Foo a where
type Bar a :: *
foo :: Xyzzy (Bar a) => a -> Bar a
baz :: (Foo a, Xyzzy (Bar a)) => a -> Int