summaryrefslogtreecommitdiff
path: root/examples/gfcc/compiler/ErrM.hs
diff options
context:
space:
mode:
authoraarne <unknown>2004-11-08 09:22:37 +0000
committeraarne <unknown>2004-11-08 09:22:37 +0000
commit7dd63a449f9683e56d310148cadd813599323a0b (patch)
tree340bc2ebe4e9998269e06ac296ab3cbc02515e2c /examples/gfcc/compiler/ErrM.hs
parent2bd22e078aa0205f60bb414d2e7f17d73db1eaea (diff)
completing for release
Diffstat (limited to 'examples/gfcc/compiler/ErrM.hs')
-rw-r--r--examples/gfcc/compiler/ErrM.hs15
1 files changed, 15 insertions, 0 deletions
diff --git a/examples/gfcc/compiler/ErrM.hs b/examples/gfcc/compiler/ErrM.hs
new file mode 100644
index 000000000..85c311a88
--- /dev/null
+++ b/examples/gfcc/compiler/ErrM.hs
@@ -0,0 +1,15 @@
+-- BNF Converter: Error Monad
+-- Copyright (C) 2004 Author: Aarne Ranta
+
+-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.
+module ErrM where
+
+-- the Error monad: like Maybe type with error msgs
+
+data Err a = Ok a | Bad String
+ deriving (Read, Show, Eq)
+
+instance Monad Err where
+ return = Ok
+ Ok a >>= f = f a
+ Bad s >>= f = Bad s