type-prelude-0.1: Partial port of prelude to the type level. Requires GHC 7.6.1.

Safe HaskellNone

Prelude.Type.Match

Synopsis

Documentation

class Match a b p | a b -> pSource

Match

Used by Case to match patterns.

Match +a ?b -c Given a type a, match it with a pattern b, unifying the type variables. If it matches, c is True, otherwise c is False.

>>> value (T :: Match (Just True) (Just x) p => T '(x, p)) :: (Bool, Bool)
(True, True)

Match is in a seperate module because I use IncoherentInstances to match type variables.

Instances

Match Bool False True False 
(~ Bool false False, ~ Bool match True) => Match Bool False false match 
Match Bool True False False 
(~ Bool true True, ~ Bool match True) => Match Bool True true match 
Match Ordering LT EQ False 
Match Ordering LT GT False 
(~ Ordering lt LT, ~ Bool match True) => Match Ordering LT lt match 
Match Ordering EQ LT False 
Match Ordering EQ GT False 
(~ Ordering eq EQ, ~ Bool match True) => Match Ordering EQ eq match 
Match Ordering GT LT False 
Match Ordering GT EQ False 
(~ Ordering gt GT, ~ Bool match True) => Match Ordering GT gt match 
~ () a b => Match () a b True 
(~ k a b, ~ Bool p True) => Match k a b p 
(~ Integer zeros Zeros, ~ Bool true True) => Match Integer Zeros zeros true 
Match Integer Zeros Ones False 
(~ Integer ones Ones, ~ Bool true True) => Match Integer Ones ones true 
Match Integer Ones Zeros False 
Match Integer Zeros (Zero j) False 
Match Integer Zeros (One j) False 
Match Integer Ones (Zero j) False 
Match Integer Ones (One j) False 
(~ Integer zero_j (Zero j), Match Integer i j p) => Match Integer (Zero i) zero_j p 
Match Integer (Zero i) Zeros False 
Match Integer (Zero i) Ones False 
(~ Integer one_j (One j), Match Integer i j p) => Match Integer (One i) one_j p 
Match Integer (One i) Zeros False 
Match Integer (One i) Ones False 
Match Integer (Zero i) (One i) False 
Match Integer (One i) (Zero j) False 
(~ [k] nil ([] k), ~ Bool true True) => Match [k] ([] k) nil true 
(~ (Maybe k) nothing (Nothing k), ~ Bool true true) => Match (Maybe k) (Nothing k) nothing true 
Match (Maybe k) (Nothing k) (Just k a) False 
Match [k] ([] k) (: k x xs) False 
(~ (Maybe k) just_b (Just k b), Match k a b p) => Match (Maybe k) (Just k a) just_b p 
~ Bool false False => Match (Maybe k) (Just k a) (Nothing k) false 
(~ [k] cons (: k y ys), Match k x y m, If Constraint m (Match [k] xs ys p) (~ Bool p False)) => Match [k] (: k x xs) cons p 
Match [k] (: k x xs) ([] k) False 
(~ (Either k k1) right_b (Right k k1 b), Match k1 a b p) => Match (Either k k1) (Right k k1 a) right_b p 
(~ (Either k k1) left_b (Left k k1 b), Match k a b p) => Match (Either k k1) (Left k k1 a) left_b p 
Match (Either k k1) (Right k k1 a) (Left k k1 b) False 
Match (Either k k1) (Left k k1 a) (Right k k1 b) False 
(~ ((,) k k1) e_f ((,) k k1 e f), Match k a e p, Match k1 b f q, ~ Bool r (&& p q)) => Match ((,) k k1) ((,) k k1 a b) e_f r 
(~ ((,,) k k1 k2) e_f_g ((,,) k k1 k2 e f g), Match k a e p, Match k1 b f q, Match k2 c g r, ~ Bool (&& p q) s, ~ Bool (&& r s) t) => Match ((,,) k k1 k2) ((,,) k k1 k2 a b c) e_f_g t 
(~ ((,,,) k k1 k2 k3) e_f_g_h ((,,,) k k1 k2 k3 e f g h), Match k a e p, Match k1 b f q, Match k2 c g r, Match k3 d h s, ~ Bool (&& p q) t, ~ Bool (&& r s) u, ~ Bool (&& t u) v) => Match ((,,,) k k1 k2 k3) ((,,,) k k1 k2 k3 a b c d) e_f_g_h v