Commit 536bf829 authored by Finn Teegen's avatar Finn Teegen
Browse files

Remove monadlist dependency

parent c94cb66c
......@@ -48,7 +48,6 @@ Library
, directory
, extra >= 1.4.6
, filepath
, monadlist
, mtl
, pretty
, process
......@@ -147,7 +146,6 @@ Executable curry-frontend
, directory
, extra >= 1.4.6
, filepath
, monadlist
, mtl
, pretty
, process
......
......@@ -3,10 +3,10 @@
Description : Auxiliary functions
Copyright : (c) 2001 - 2003 Wolfgang Lux
2011 - 2015 Björn Peemöler
2016 Finn Teegen
2016 - 2017 Finn Teegen
License : BSD-3-clause
Maintainer : bjp@informatik.uni-kiel.de
Maintainer : fte@informatik.uni-kiel.de
Stability : experimental
Portability : portable
......@@ -17,9 +17,11 @@
module Base.Utils
( fst3, snd3, thd3, curry3, uncurry3
, (++!), foldr2, findDouble, findMultiples
, (++!), foldr2, mapAccumM, findDouble, findMultiples
) where
import Control.Monad (MonadPlus, mzero, mplus)
import Data.List (partition)
infixr 5 ++!
......@@ -65,6 +67,14 @@ foldr2 _ z [] _ = z
foldr2 _ z _ [] = z
foldr2 f z (x : xs) (y : ys) = f x y (foldr2 f z xs ys)
mapAccumM :: (Monad m, MonadPlus p) => (acc -> x -> m (acc, y)) -> acc -> [x]
-> m (acc, p y)
mapAccumM _ z [] = return (z, mzero)
mapAccumM f z (x:xs) = do
(z', y) <- f z x
(z'', ys) <- mapAccumM f z' xs
return (z'', return y `mplus` ys)
-- The function 'findDouble' checks whether a list of entities is linear,
-- i.e., if every entity in the list occurs only once. If it is non-linear,
-- the first offending object is returned.
......
......@@ -42,7 +42,6 @@ import Control.Applicative ((<$>), (<*>))
import Control.Monad.Extra ( (&&^), allM, filterM, foldM
, liftM, notM, replicateM, unless
, unlessM )
import Control.Monad.ListM (mapAccumM)
import qualified Control.Monad.State as S (State, runState, gets, modify)
import Data.List (nub, nubBy, partition, sortBy)
import Data.Function (on)
......@@ -68,7 +67,7 @@ import Base.TopEnv
import Base.TypeExpansion
import Base.Types
import Base.TypeSubst
import Base.Utils (foldr2, fst3, snd3, thd3, uncurry3)
import Base.Utils (foldr2, fst3, snd3, thd3, uncurry3, mapAccumM)
import Env.Class
import Env.Instance
......
......@@ -16,7 +16,6 @@ module Transformations.Derive (derive) where
#if __GLASGOW_HASKELL__ < 710
import Control.Applicative ((<$>))
#endif
import Control.Monad.ListM (mapAccumM)
import qualified Control.Monad.State as S (State, evalState, gets, modify)
import Data.List (intercalate, intersperse)
import Data.Maybe (fromJust, isJust)
......@@ -31,7 +30,7 @@ import Base.Messages (internalError)
import Base.Types
import Base.TypeSubst (instanceType)
import Base.Typing (typeOf)
import Base.Utils (snd3)
import Base.Utils (snd3, mapAccumM)
import Env.Instance
import Env.OpPrec
......
......@@ -61,7 +61,6 @@ import Control.Applicative ((<$>), (<*>))
import Control.Arrow (first, second)
import Control.Monad (liftM2)
import Control.Monad.Extra (concatMapM)
import Control.Monad.ListM (mapAccumM)
import qualified Control.Monad.State as S (State, runState, gets, modify)
import Data.Foldable (foldrM)
import Data.List ( (\\), elemIndex, nub, partition
......@@ -80,7 +79,7 @@ import Base.TypeExpansion
import Base.Types
import Base.TypeSubst
import Base.Typing
import Base.Utils (fst3)
import Base.Utils (fst3, mapAccumM)
import Env.TypeConstructor (TCEnv, TypeInfo (..), qualLookupTypeInfo)
import Env.Value (ValueEnv, ValueInfo (..), qualLookupValue)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment