annotate lib/ur/monad.urs @ 2009:799be3911ce3

Monadic bind supports patterns
author Adam Chlipala <adam@chlipala.net>
date Fri, 02 May 2014 17:16:02 -0400
parents a613cae954ca
children cbd294994c69
rev   line source
adamc@834 1 val exec : m ::: (Type -> Type) -> monad m -> ts ::: {Type}
adamc@834 2 -> $(map m ts) -> folder ts -> m $ts
adamc@898 3
adamc@898 4 val ignore : m ::: (Type -> Type) -> monad m -> t ::: Type
adamc@898 5 -> m t -> m unit
adamc@905 6
adamc@917 7 val mp : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type
adamc@917 8 -> (a -> b) -> m a -> m b
adamc@917 9
adam@1768 10 val liftM : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type
adam@1768 11 -> (a -> b) -> m a -> m b
adam@1768 12 (* Haskell-style synonym for [mp] *)
adam@1768 13
adam@1768 14 val liftM2 : m ::: (Type -> Type) -> monad m -> a ::: Type -> b ::: Type -> c ::: Type
adam@1768 15 -> (a -> b -> c) -> m a -> m b -> m c
adam@1768 16
adamc@905 17 val foldR : K --> m ::: (Type -> Type) -> monad m
adamc@905 18 -> tf :: (K -> Type)
adamc@905 19 -> tr :: ({K} -> Type)
adamc@905 20 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@905 21 -> [[nm] ~ rest] =>
adamc@905 22 tf t -> tr rest -> m (tr ([nm = t] ++ rest)))
adamc@905 23 -> tr []
adamc@1093 24 -> r ::: {K} -> folder r -> $(map tf r) -> m (tr r)
adamc@905 25
adamc@905 26 val foldR2 : K --> m ::: (Type -> Type) -> monad m
adamc@905 27 -> tf1 :: (K -> Type) -> tf2 :: (K -> Type)
adamc@905 28 -> tr :: ({K} -> Type)
adamc@905 29 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@905 30 -> [[nm] ~ rest] =>
adamc@905 31 tf1 t -> tf2 t -> tr rest -> m (tr ([nm = t] ++ rest)))
adamc@905 32 -> tr []
adamc@1093 33 -> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> m (tr r)
adamc@905 34
adamc@910 35 val foldR3 : K --> m ::: (Type -> Type) -> monad m
adamc@910 36 -> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> tf3 :: (K -> Type)
adamc@910 37 -> tr :: ({K} -> Type)
adamc@910 38 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@910 39 -> [[nm] ~ rest] =>
adamc@910 40 tf1 t -> tf2 t -> tf3 t -> tr rest -> m (tr ([nm = t] ++ rest)))
adamc@910 41 -> tr []
adamc@1093 42 -> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> m (tr r)
adamc@910 43
adamc@1172 44 val mapR0 : K --> m ::: (Type -> Type) -> monad m
adamc@1172 45 -> tr :: (K -> Type)
adamc@1172 46 -> (nm :: Name -> t :: K -> m (tr t))
adamc@1172 47 -> r ::: {K} -> folder r -> m ($(map tr r))
adamc@1172 48
adamc@905 49 val mapR : K --> m ::: (Type -> Type) -> monad m
adamc@905 50 -> tf :: (K -> Type)
adamc@905 51 -> tr :: (K -> Type)
adamc@905 52 -> (nm :: Name -> t :: K -> tf t -> m (tr t))
adamc@1093 53 -> r ::: {K} -> folder r -> $(map tf r) -> m ($(map tr r))
adamc@937 54
adamc@937 55 val mapR2 : K --> m ::: (Type -> Type) -> monad m
adamc@937 56 -> tf1 :: (K -> Type) -> tf2 :: (K -> Type)
adamc@937 57 -> tr :: (K -> Type)
adamc@937 58 -> (nm :: Name -> t :: K -> tf1 t -> tf2 t -> m (tr t))
adamc@1093 59 -> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> m ($(map tr r))
adamc@1175 60
adamc@1175 61 val foldMapR : K --> m ::: (Type -> Type) -> monad m
adamc@1175 62 -> tf :: (K -> Type)
adamc@1175 63 -> tf' :: (K -> Type)
adamc@1175 64 -> tr :: ({K} -> Type)
adamc@1175 65 -> (nm :: Name -> t :: K -> rest :: {K}
adamc@1175 66 -> [[nm] ~ rest] =>
adamc@1175 67 tf t -> tr rest -> m (tf' t * tr ([nm = t] ++ rest)))
adamc@1175 68 -> tr []
adamc@1175 69 -> r ::: {K} -> folder r -> $(map tf r) -> m ($(map tf' r) * tr r)
adamc@1257 70
adam@1312 71 val appR : K --> m ::: (Type -> Type) -> monad m
adam@1312 72 -> tf :: (K -> Type)
adam@1312 73 -> (nm :: Name -> t :: K -> tf t -> m unit)
adam@1312 74 -> r ::: {K} -> folder r -> $(map tf r) -> m unit
adam@1312 75
adamc@1257 76 val appR2 : K --> m ::: (Type -> Type) -> monad m
adamc@1257 77 -> tf1 :: (K -> Type) -> tf2 :: (K -> Type)
adam@1310 78 -> (nm :: Name -> t :: K -> tf1 t -> tf2 t -> m unit)
adamc@1257 79 -> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> m unit
adam@1313 80
adam@1313 81 val appR3 : K --> m ::: (Type -> Type) -> monad m
adam@1313 82 -> tf1 :: (K -> Type) -> tf2 :: (K -> Type) -> tf3 :: (K -> Type)
adam@1313 83 -> (nm :: Name -> t :: K -> tf1 t -> tf2 t -> tf3 t -> m unit)
adam@1313 84 -> r ::: {K} -> folder r -> $(map tf1 r) -> $(map tf2 r) -> $(map tf3 r) -> m unit