Skip to content

Instantly share code, notes, and snippets.

@ahammar
Created June 10, 2011 18:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahammar/1019376 to your computer and use it in GitHub Desktop.
Save ahammar/1019376 to your computer and use it in GitHub Desktop.
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
baz = xyzzy . foo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment