-
Notifications
You must be signed in to change notification settings - Fork 3
/
Debugs.hs
37 lines (30 loc) · 823 Bytes
/
Debugs.hs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
{-# OPTIONS -Wall -fno-warn-unused-do-bind #-}
module Debugs
(Rule(..)
,Environment(..)
,Choose(..)
,Punctuation
,W(..)
,Condition(..)
,cook
,SettingSpecifier(..)
,makeEnv
,(>>>=)
,lift,lift2
,c
)where
import Prelude hiding (undefined)
import Akrantiain.Pattern_match
import Akrantiain.Structure
import Akrantiain.Rule
import System.IO
import qualified Data.Set as S
makeEnv :: Punctuation -> Environment
makeEnv punct = Env{pun=punct, bools=S.fromList[CASE_SENSITIVE]}
(>>>=) :: (Show a) => Either a b -> ( b -> IO ()) -> IO ()
Left a >>>= _ = hPrint stderr a
Right b >>>= f = f b
lift a = R{leftneg = Nothing, leftdollar = [], middle = a, rightdollar = [], rightneg = Nothing}
lift2 d a b = R{leftneg = Nothing, leftdollar = d, middle = a, rightdollar = b, rightneg = Nothing}
c :: a -> Choose a
c = Ch . (:[])