mirror of
https://github.com/GrammaticalFramework/gf-core.git
synced 2026-04-23 11:42:49 -06:00
Update some old unused code to support newer ghc
This commit is contained in:
@@ -1,3 +1,5 @@
|
|||||||
|
{-# LANGUAGE CPP #-}
|
||||||
|
{-# LANGUAGE DeriveFunctor #-}
|
||||||
-- BNF Converter: Error Monad
|
-- BNF Converter: Error Monad
|
||||||
-- Copyright (C) 2004 Author: Aarne Ranta
|
-- Copyright (C) 2004 Author: Aarne Ranta
|
||||||
|
|
||||||
@@ -6,12 +8,17 @@ module GFCC.ErrM where
|
|||||||
|
|
||||||
-- Control.Monad.Fail import will become redundant in GHC 8.8+
|
-- Control.Monad.Fail import will become redundant in GHC 8.8+
|
||||||
import qualified Control.Monad.Fail as Fail
|
import qualified Control.Monad.Fail as Fail
|
||||||
|
import Control.Monad (ap)
|
||||||
|
|
||||||
|
|
||||||
-- the Error monad: like Maybe type with error msgs
|
-- the Error monad: like Maybe type with error msgs
|
||||||
|
|
||||||
data Err a = Ok a | Bad String
|
data Err a = Ok a | Bad String
|
||||||
deriving (Read, Show, Eq)
|
deriving (Read, Show, Eq, Functor)
|
||||||
|
|
||||||
|
instance Applicative Err where
|
||||||
|
pure = Ok
|
||||||
|
(<*>) = ap
|
||||||
|
|
||||||
instance Monad Err where
|
instance Monad Err where
|
||||||
return = Ok
|
return = Ok
|
||||||
|
|||||||
Reference in New Issue
Block a user