Mercurial > urweb
comparison lib/basis.urs @ 564:803b2f3bb86b
Monad type class seems to be working
author | Adam Chlipala <adamc@hcoop.net> |
---|---|
date | Fri, 19 Dec 2008 10:27:58 -0500 |
parents | 5d494183ca89 |
children | 74800be65591 |
comparison
equal
deleted
inserted
replaced
563:44958d74c43f | 564:803b2f3bb86b |
---|---|
67 val read_string : read string | 67 val read_string : read string |
68 val read_bool : read bool | 68 val read_bool : read bool |
69 val read_time : read time | 69 val read_time : read time |
70 | 70 |
71 | 71 |
72 (** * Transactions *) | 72 (** * Monads *) |
73 | |
74 class monad :: Type -> Type | |
75 val return : m ::: (Type -> Type) -> t ::: Type | |
76 -> monad m | |
77 -> t -> m t | |
78 val bind : m ::: (Type -> Type) -> t1 ::: Type -> t2 ::: Type | |
79 -> monad m | |
80 -> m t1 -> (t1 -> m t2) | |
81 -> m t2 | |
82 | |
83 (** ** Transactions *) | |
73 | 84 |
74 con transaction :: Type -> Type | 85 con transaction :: Type -> Type |
75 | 86 val transaction_monad : monad transaction |
76 val return : t ::: Type | 87 |
77 -> t -> transaction t | |
78 val bind : t1 ::: Type -> t2 ::: Type | |
79 -> transaction t1 -> (t1 -> transaction t2) | |
80 -> transaction t2 | |
81 | 88 |
82 | 89 |
83 (** HTTP operations *) | 90 (** HTTP operations *) |
84 | 91 |
85 val requestHeader : string -> transaction (option string) | 92 val requestHeader : string -> transaction (option string) |