author | paulson |
Thu, 26 Sep 1996 12:47:47 +0200 | |
changeset 2031 | 03a843f0f447 |
parent 1557 | fe30812f5b5e |
child 2525 | 477c05586286 |
permissions | -rw-r--r-- |
1300 | 1 |
(* Title: HOL/MiniML/Maybe.thy |
2 |
ID: $Id$ |
|
3 |
Author: Dieter Nazareth and Tobias Nipkow |
|
4 |
Copyright 1995 TU Muenchen |
|
5 |
||
6 |
Universal error monad. |
|
7 |
*) |
|
8 |
||
9 |
Maybe = List + |
|
10 |
||
11 |
datatype 'a maybe = Ok 'a | Fail |
|
12 |
||
1557 | 13 |
constdefs |
14 |
bind :: ['a maybe, 'a => 'b maybe] => 'b maybe (infixl 60) |
|
15 |
"m bind f == case m of Ok r => f r | Fail => Fail" |
|
1300 | 16 |
|
1400 | 17 |
syntax "@bind" :: [pttrns,'a maybe,'b] => 'c ("(_ := _;//_)" 0) |
18 |
translations "P := E; F" == "E bind (%P.F)" |
|
19 |
||
1300 | 20 |
end |