1
0
forked from GitHub/gf-core

Replace all the different ErrM.hs modules with GF.Data.ErrM.

This commit is contained in:
bringert
2007-12-20 17:34:12 +00:00
parent 070ccd045d
commit 3eba035691
23 changed files with 22 additions and 117 deletions

View File

@@ -24,7 +24,7 @@ import GF.GFCC.Raw.ConvertGFCC
import GF.GFCC.Raw.ParGFCCRaw
import GF.Command.PPrTree
import GF.GFCC.ErrM
import GF.Data.ErrM
import GF.Parsing.FCFG
import GF.Conversion.SimpleToFCFG (convertGrammar)

View File

@@ -3,7 +3,7 @@ module GF.GFCC.CheckGFCC (checkGFCC, checkGFCCio, checkGFCCmaybe) where
import GF.GFCC.CId
import GF.GFCC.Macros
import GF.GFCC.DataGFCC
import GF.GFCC.ErrM
import GF.Data.ErrM
import qualified Data.Map as Map
import Control.Monad

View File

@@ -1,26 +0,0 @@
-- BNF Converter: Error Monad
-- Copyright (C) 2004 Author: Aarne Ranta
-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.
module GF.GFCC.ErrM where
-- the Error monad: like Maybe type with error msgs
import Control.Monad (MonadPlus(..), liftM)
data Err a = Ok a | Bad String
deriving (Read, Show, Eq, Ord)
instance Monad Err where
return = Ok
fail = Bad
Ok a >>= f = f a
Bad s >>= f = Bad s
instance Functor Err where
fmap = liftM
instance MonadPlus Err where
mzero = Bad "Err.mzero"
mplus (Bad _) y = y
mplus x _ = x

View File

@@ -1,26 +0,0 @@
-- BNF Converter: Error Monad
-- Copyright (C) 2004 Author: Aarne Ranta
-- This file comes with NO WARRANTY and may be used FOR ANY PURPOSE.
module GF.GFCC.Raw.ErrM where
-- the Error monad: like Maybe type with error msgs
import Control.Monad (MonadPlus(..), liftM)
data Err a = Ok a | Bad String
deriving (Read, Show, Eq, Ord)
instance Monad Err where
return = Ok
fail = Bad
Ok a >>= f = f a
Bad s >>= f = Bad s
instance Functor Err where
fmap = liftM
instance MonadPlus Err where
mzero = Bad "Err.mzero"
mplus (Bad _) y = y
mplus x _ = x

View File

@@ -3,7 +3,7 @@
module GF.GFCC.Raw.ParGFCCRaw (parseGrammar) where
import GF.GFCC.Raw.AbsGFCCRaw
import GF.GFCC.Raw.LexGFCCRaw
import GF.GFCC.Raw.ErrM
import GF.Data.ErrM
#if __GLASGOW_HASKELL__ >= 503
import Data.Array
#else

View File

@@ -4,7 +4,7 @@
module GF.GFCC.Raw.ParGFCCRaw (parseGrammar) where
import GF.GFCC.Raw.AbsGFCCRaw
import GF.GFCC.Raw.LexGFCCRaw
import GF.GFCC.Raw.ErrM
import GF.Data.ErrM
}
%name pGrammar Grammar

View File

@@ -3,7 +3,7 @@ module GF.GFCC.SkelGFCC where
-- Haskell module generated by the BNF converter
import GF.GFCC.AbsGFCC
import GF.GFCC.ErrM
import GF.Data.ErrM
type Result = Err String
failure :: Show a => a -> Result

View File

@@ -14,7 +14,7 @@ import GF.GFCC.AbsGFCC
import GF.GFCC.ErrM
import GF.Data.ErrM
type ParseFun a = [Token] -> Err a