Advertisement
Guest User

Untitled

a guest
Mar 26th, 2017
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. {-# LANGUAGE ConstraintKinds, DataKinds, TypeOperators, TypeFamilies #-}
  2.  
  3. import GHC.Exts
  4.  
  5. type A a = Num a ': Eq a ': Ord a ': '[]
  6.  
  7. type family ListOfConstraints (a :: [Constraint]) :: Constraint where
  8. ListOfConstraints '[] = ()
  9. ListOfConstraints (c ': cs) = (c, ListOfConstraints cs)
  10.  
  11. f :: ListOfConstraints (A a) => a -> a -> a
  12. f x y = max x y * 3
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement