diff --git a/pkg/hs/urbit-noun-core/lib/Urbit/Noun/Convert.hs b/pkg/hs/urbit-noun-core/lib/Urbit/Noun/Convert.hs index f72a465dfd..97df9e085c 100644 --- a/pkg/hs/urbit-noun-core/lib/Urbit/Noun/Convert.hs +++ b/pkg/hs/urbit-noun-core/lib/Urbit/Noun/Convert.hs @@ -22,78 +22,6 @@ import qualified Control.Monad.Fail as Fail type ParseStack = [Text] --- IResult --------------------------------------------------------------------- - -data IResult a = IError ParseStack String | ISuccess a - deriving (Eq, Show, Typeable, Functor, Foldable, Traversable) - -instance Applicative IResult where - pure = ISuccess - (<*>) = ap - -instance Fail.MonadFail IResult where - fail err = IError [] err - -instance Monad IResult where - return = pure - fail = Fail.fail - ISuccess a >>= k = k a - IError path err >>= _ = IError path err - -instance MonadPlus IResult where - mzero = fail "mzero" - mplus a@(ISuccess _) _ = a - mplus _ b = b - -instance Alternative IResult where - empty = mzero - (<|>) = mplus - -instance Semigroup (IResult a) where - (<>) = mplus - -instance Monoid (IResult a) where - mempty = fail "mempty" - mappend = (<>) - - --- Result ---------------------------------------------------------------------- - -data Result a = Error String | Success a - deriving (Eq, Show, Typeable, Functor, Foldable, Traversable) - -instance Applicative Result where - pure = Success - (<*>) = ap - -instance Fail.MonadFail Result where - fail err = Error err - -instance Monad Result where - return = pure - fail = Fail.fail - - Success a >>= k = k a - Error err >>= _ = Error err - -instance MonadPlus Result where - mzero = fail "mzero" - mplus a@(Success _) _ = a - mplus _ b = b - -instance Alternative Result where - empty = mzero - (<|>) = mplus - -instance Semigroup (Result a) where - (<>) = mplus - {-# INLINE (<>) #-} - -instance Monoid (Result a) where - mempty = fail "mempty" - mappend = (<>) - - -- "Parser" -------------------------------------------------------------------- type Failure f r = ParseStack -> String -> f r