Commit 5d43350b authored by Mart Lubbers's avatar Mart Lubbers

First sweep qualified as

Removes all standard qualified as
There is a problem with Data.Array
Modules not imported by the test program are not touched.. yet
parent 4978e569
Pipeline #15142 passed with stage
in 1 minute and 14 seconds
......@@ -28,7 +28,7 @@ import Text.Language
import Text.Parsers.Simple.ParserCombinators
from Clean.Types import :: Type, :: TypeRestriction
import qualified Clean.Types.Parse as T
from Clean.Types.Parse import parseType
from Clean.Types.Util import instance toString Type
gDefault{|Maybe|} _ = Nothing
......@@ -164,7 +164,7 @@ where
= Nothing
docBlockToDoc{|Type|} (Left []) = Left InternalNoDataError
docBlockToDoc{|Type|} (Left ss) = case [v \\ Just v <- map ('T'.parseType o fromString) ss] of
docBlockToDoc{|Type|} (Left ss) = case [v \\ Just v <- map (parseType o fromString) ss] of
[] -> Left (UnknownError "no parsable type")
vs -> Right (last vs, [])
......@@ -193,7 +193,7 @@ where
skipSpaces = pMany (pSatisfy isSpace) *> pYield undef
pTypeWithColonOrSemicolon = (pMany (pSatisfy \c -> c <> ':' && c <> ';') <* pOneOf [':;'])
>>= \t -> case 'T'.parseType t of
>>= \t -> case parseType t of
Nothing -> pError "type could not be parsed"
Just t -> pure t
......@@ -201,12 +201,12 @@ where
parseProperty ss = Right (trimMultiLine ss, [])
docBlockToDoc{|PropertyVarInstantiation|} (Left [s]) = case split "=" s of
[var:type:[]] -> case 'T'.parseType (fromString type) of
[var:type:[]] -> case parseType (fromString type) of
Just t -> Right (PropertyVarInstantiation (trim var, t), [])
Nothing -> Left (UnknownError "type could not be parsed")
_ -> Left (UnknownError "property var instantiation could not be parsed")
docBlockToDoc{|PropertyTestGenerator|} (Left [s]) = case 'T'.parseType (fromString sig) of
docBlockToDoc{|PropertyTestGenerator|} (Left [s]) = case parseType (fromString sig) of
Just t -> Right (PropertyTestGenerator t (trimMultiLine imp), [])
Nothing -> Left (UnknownError "type could not be parsed")
where
......
......@@ -13,8 +13,7 @@ import StdTuple
import Control.Monad
import Data.Error
import Data.Functor
from Data.Map import :: Map
import qualified Data.Map as M
from Data.Map import :: Map, newMap
import Data.Maybe
import System.File
import System.FilePath
......@@ -226,17 +225,17 @@ instance < CommentIndex where < (CI a b c) (CI d e f) = (a,b,c) < (d,e,f)
putCC k v coll :== case commentIndex k of
Nothing -> coll
Just k -> 'M'.put k v coll
Just k -> put k v coll
emptyCollectedComments :: CollectedComments
emptyCollectedComments = 'M'.newMap
emptyCollectedComments = newMap
getComment :: !a !CollectedComments -> Maybe String | commentIndex a
getComment elem coll = (\cc -> cc.content) <$> (flip 'M'.get coll =<< commentIndex elem)
getComment elem coll = (\cc -> cc.content) <$> (flip get coll =<< commentIndex elem)
collectComments :: ![CleanComment] !ParsedModule -> CollectedComments
collectComments comments pm
# coll = 'M'.newMap
# coll = newMap
# (comments,coll) = case comments of
[] -> ([], coll)
[c:cs]
......
......@@ -14,7 +14,7 @@ from Data.Func import $
import Data.Functor
import Data.GenEq
import Data.List
import qualified Data.Map as M
from Data.Map import :: Map(..), get
import Data.Maybe
import Data.Tuple
from Text import class Text (concat), instance Text String
......@@ -187,7 +187,7 @@ propagate_uniqueness p (Strict t)
propagate_uniqueness p t
= t
resolve_synonyms :: ('M'.Map String [TypeDef]) !Type -> ([TypeDef], Type)
resolve_synonyms :: (Map String [TypeDef]) !Type -> ([TypeDef], Type)
resolve_synonyms tds (Type t ts)
# (syns, ts) = appFst (removeDupTypedefs o flatten) $ unzip $ map (resolve_synonyms tds) ts
= case candidates of
......@@ -203,7 +203,7 @@ resolve_synonyms tds (Type t ts)
= appFst ((++) [syn:syns]) $ resolve_synonyms tds t
= appFst ((++) [syn:syns]) $ resolve_synonyms tds t
where
candidates = [td \\ td=:{td_rhs=TDRSynonym syn} <- fromMaybe [] $ 'M'.get t tds
candidates = [td \\ td=:{td_rhs=TDRSynonym syn} <- fromMaybe [] $ get t tds
| length td.td_args <= tslen && (isType syn || length td.td_args == tslen)]
where tslen = length ts
resolve_synonyms tds (Func is r tc)
......@@ -268,7 +268,7 @@ reduceArities (Forall tvs t tc) = Forall tvs (reduceArities t) tc
reduceArities (Arrow mt) = Arrow (reduceArities <$> mt)
reduceArities (Strict t) = Strict $ reduceArities t
normalise_type :: (String -> Bool) !('M'.Map String [TypeDef]) !Type -> (!Type, ![TypeDef], ![TypeVar])
normalise_type :: (String -> Bool) !(Map String [TypeDef]) !Type -> (!Type, ![TypeDef], ![TypeVar])
normalise_type alwaysUnique tds t
# t = reduceArities t
# (syns,t) = resolve_synonyms tds t
......
......@@ -2,8 +2,7 @@ implementation module Control.Applicative
import Control.Monad
import Data.Func, Data.Functor, System.IO, Data.List, Data.Maybe
from Data.Monoid import class Monoid, class Semigroup
import qualified Data.Monoid as DM
import Data.Monoid
from StdFunc import id, o, flip, const
getConst :: !(Const a b) -> a
......@@ -13,14 +12,14 @@ instance Functor (Const m) where
fmap _ (Const v) = Const v
instance Semigroup (Const a b) | Semigroup a where
mappend (Const a) (Const b) = Const ('DM'.mappend a b)
mappend (Const a) (Const b) = Const (mappend a b)
instance Monoid (Const a b) | Monoid a where
mempty = Const 'DM'.mempty
mempty = Const mempty
instance Applicative (Const m) | Monoid m where
pure _ = Const 'DM'.mempty
(<*>) (Const f) (Const v) = Const ('DM'.mappend f v)
pure _ = Const mempty
(<*>) (Const f) (Const v) = Const (mappend f v)
unwrapMonad :: !(WrappedMonad m a) -> m a
unwrapMonad (WrapMonad x) = x
......
......@@ -3,7 +3,7 @@ implementation module Data.CircularStack
//import StdInt, StdOverloaded, StdArray, StdMisc, StdList
import StdInt, StdList, StdMisc
from Data.IntMap.Strict import :: IntMap
import qualified Data.IntMap.Strict as DIS
import qualified Data.IntMap.Strict
from Data.Maybe import :: Maybe (..)
newStack :: !Int -> CircularStack a
......@@ -11,13 +11,13 @@ newStack n = { CircularStack
| maxSize = n
, actualSize = 0
, nextIdx = 0
, stackData = 'DIS'.newMap
, stackData = 'Data.IntMap.Strict'.newMap
}
push :: !a !(CircularStack a) -> CircularStack a
push x stack
= { stack
& stackData = 'DIS'.put stack.nextIdx x stack.stackData
& stackData = 'Data.IntMap.Strict'.put stack.nextIdx x stack.stackData
, actualSize = if (stack.actualSize == stack.maxSize)
stack.actualSize
(stack.actualSize + 1)
......@@ -29,7 +29,7 @@ pop stack
| emptyStack stack = (Nothing, stack)
| otherwise
# topIdx = topElemIdx stack
= ( 'DIS'.get topIdx stack.stackData
= ( 'Data.IntMap.Strict'.get topIdx stack.stackData
, { stack
& nextIdx = topIdx
, actualSize = stack.actualSize - 1})
......@@ -37,7 +37,7 @@ pop stack
peek :: !(CircularStack a) -> Maybe a
peek stack
| emptyStack stack = Nothing
| otherwise = 'DIS'.get (topElemIdx stack) stack.stackData
| otherwise = 'Data.IntMap.Strict'.get (topElemIdx stack) stack.stackData
topElemIdx :: !(CircularStack a) -> Int
topElemIdx stack
......
......@@ -3,14 +3,13 @@ implementation module Data.Either
from StdEnv import flip, id, o, const
from StdMisc import abort
import Control.Applicative
import Control.Monad
import Control.Monad => qualified mapM
import Data.Monoid
import Data.Functor
import Data.Maybe
import Data.Monoid
from Data.Foldable import class Foldable(foldMap,foldl,foldr)
from Data.Traversable import class Traversable(traverse)
import qualified Data.Traversable as T
from Data.Traversable import class Traversable(traverse,mapM)
import Data.Bifunctor
import Data.GenEq
......@@ -67,7 +66,7 @@ where
traverse f (Right y) = Right <$> f y
sequenceA f = traverse id f
mapM f x = unwrapMonad (traverse (WrapMonad o f) x)
sequence x = 'T'.mapM id x
sequence x = mapM id x
instance Bifunctor Either
where
......
......@@ -7,7 +7,6 @@ from Control.Monad import class Monad(..), >>=
from Data.List import instance Semigroup [a], instance Monoid [a], instance Foldable []
import Data.Monoid
import Data.Maybe
import qualified StdList as SL
import StdClass
from StdOverloaded import class < (..)
from StdBool import not
......
implementation module Data.GenDiff
import StdArray
import StdBool
from StdFunc import flip, o
import StdGeneric
import StdInt
import StdList
import StdString
import StdEnv
import Control.Applicative
import Control.Monad
......@@ -15,7 +9,7 @@ import Control.Monad.State
import Data.Functor
import Text.GenPrint
import Data.List
import qualified Data.Map as M
from Data.Map import :: Map, findWithDefault, fromList
import Data.Maybe
from Text import class Text(concat), instance Text String, <+
......@@ -122,10 +116,10 @@ where
modify (\st -> {st & inlist=d.value == "_Cons"}) >>|
sequence [indent (display c) \\ c <- reverse d.children] >>|
modify (\st -> {st & inlist=inlist}) >>|
print ('M'.findWithDefault d.value d.value constructors) >>|
print (findWithDefault d.value d.value constructors) >>|
newline d.status
where
constructors = 'M'.fromList
constructors = fromList
[ ("_Nil", "[]")
, ("_Cons", "[]")
: [("_Tuple" <+ i, "(" <+ repeatn (i-1) ',' <+ ")") \\ i <- [2..32]]
......
......@@ -4,7 +4,7 @@ from StdOverloaded import class < (..)
import StdClass
from Data.Maybe import :: Maybe
from StdFunc import o
import qualified Data.List as L
import qualified Data.List
from Data.Monoid import class Monoid, class Semigroup
/**
......@@ -87,37 +87,37 @@ split :: a (Heap a) -> (Heap a, Heap a, Heap a)
/**
* @type Int (Heap a) -> Heap a
*/
take :== withList o 'L'.take
take :== withList o 'Data.List'.take
/**
* @type Int (Heap a) -> Heap a
*/
drop :== withList o 'L'.drop
drop :== withList o 'Data.List'.drop
/**
* @type Int (Heap a) -> (Heap a, Heap a)
*/
splitAt :== splitWithList o 'L'.splitAt
splitAt :== splitWithList o 'Data.List'.splitAt
/**
* @type (a -> Bool) (Heap a) -> (Heap a, Heap a)
*/
break :== splitWithList o 'L'.break
break :== splitWithList o 'Data.List'.break
/**
* @type (a -> Bool) (Heap a) -> (Heap a, Heap a)
*/
span :== splitWithList o 'L'.span
span :== splitWithList o 'Data.List'.span
/**
* @type (a -> Bool) (Heap a) -> Heap a
*/
takeWhile :== withList o 'L'.takeWhile
takeWhile :== withList o 'Data.List'.takeWhile
/**
* @type (a -> Bool) (Heap a) -> Heap a
*/
dropWhile :== withList o 'L'.dropWhile
dropWhile :== withList o 'Data.List'.dropWhile
nub :: (Heap a) -> Heap a
......
implementation module Data.Heap
import qualified Data.List as L
from Control.Applicative import class Applicative (..), :: WrappedMonad (..), unwrapMonad, instance Applicative (WrappedMonad m), instance Functor (WrappedMonad m)
from Control.Monad import liftM, class Monad
import Data.Monoid
......@@ -11,7 +10,6 @@ from Data.List import instance Functor [], instance Applicative [],
import qualified Data.Traversable as Traversable
from Data.Traversable import class Traversable (..)
from Data.Foldable import class Foldable (..)
import qualified Data.Foldable as DF
from StdFunc import o, id, flip
from StdOverloaded import class < (..), class == (..), class + (..), class isEven
from StdInt import instance isEven Int, instance + Int, instance == Int, instance < Int, instance - Int
......@@ -22,7 +20,10 @@ from StdMisc import abort
import Data.Maybe
import Data.Tuple
from StdList import repeatn
import qualified StdList as SL
import qualified Data.Foldable
import qualified Data.List
import qualified StdList
// The implementation of 'Heap' must internally hold onto the dictionary entry for ('<='),
// so that it can be made 'Foldable'. Confluence in the absence of incoherent instances
......@@ -38,7 +39,7 @@ instance == (Heap a) where
(==) Empty Empty = True
(==) Empty _ = False
(==) _ Empty = False
(==) a=:(Heap s1 leq _) b=:(Heap s2 _ _) = s1 == s2 && go leq ('DF'.toList a) ('DF'.toList b)
(==) a=:(Heap s1 leq _) b=:(Heap s2 _ _) = s1 == s2 && go leq ('Data.Foldable'.toList a) ('Data.Foldable'.toList b)
where
go f [x:xs] [y:ys] = f x y && f y x && go f xs ys
go _ [] [] = True
......@@ -48,7 +49,7 @@ instance < (Heap a) where
< Empty Empty = False
< Empty _ = True
< _ Empty = False
< a=:(Heap _ leq _) b = go leq ('DF'.toList a) ('DF'.toList b)
< a=:(Heap _ leq _) b = go leq ('Data.Foldable'.toList a) ('Data.Foldable'.toList b)
where
go f [x:xs] [y:ys] =
if (f x y)
......@@ -259,14 +260,14 @@ heapify leq n=:(Node r a as)
// >>> size (fromList [1,5,3])
// 3
//fromList :: [a] -> Heap a | Ord a
fromList xs :== 'SL'.foldr insert mempty xs
fromList xs :== 'StdList'.foldr insert mempty xs
//fromListWith :: (a a -> Bool) [a] -> Heap a
fromListWith f xs :== 'SL'.foldr (insertWith f) mempty xs
fromListWith f xs :== 'StdList'.foldr (insertWith f) mempty xs
// /O(n log n)/. Perform a heap sort
//sort :: [a] -> [a] | Ord a
sort xs = 'DF'.toList (fromList xs)
sort xs = 'Data.Foldable'.toList (fromList xs)
instance Semigroup (Heap a) where
mappend l r = union l r
......@@ -373,15 +374,15 @@ split a (Heap s leq t) = foldMap f t
// >>> take 3 (fromList [10,2,4,1,9,8,2])
// fromList [1,2,2]
//take :: Int (Heap a) -> Heap a
take :== withList o 'L'.take
take :== withList o 'Data.List'.take
// /O(n log n)/. Return a heap consisting of all members of given heap except for the @n@ least elements.
//drop :: Int (Heap a) -> Heap a
drop :== withList o 'L'.drop
drop :== withList o 'Data.List'.drop
// /O(n log n)/. Split a heap into two heaps, the first containing the @n@ least elements, the latter consisting of all members of the heap except for those elements.
//splitAt :: Int (Heap a) -> (Heap a, Heap a)
splitAt :== splitWithList o 'L'.splitAt
splitAt :== splitWithList o 'Data.List'.splitAt
// /O(n log n)/. 'break' applied to a predicate @p@ and a heap @xs@ returns a tuple where the first element is a heap consisting of the
// longest prefix the least elements of @xs@ that /do not satisfy/ p and the second element is the remainder of the elements in the heap.
......@@ -391,7 +392,7 @@ splitAt :== splitWithList o 'L'.splitAt
//
// 'break' @p@ is equivalent to @'span' ('not' . p)@.
//break :: (a -> Bool) (Heap a) -> (Heap a, Heap a)
break :== splitWithList o 'L'.break
break :== splitWithList o 'Data.List'.break
// /O(n log n)/. 'span' applied to a predicate @p@ and a heap @xs@ returns a tuple where the first element is a heap consisting of the
// longest prefix the least elements of xs that satisfy @p@ and the second element is the remainder of the elements in the heap.
......@@ -401,7 +402,7 @@ break :== splitWithList o 'L'.break
//
// 'span' @p xs@ is equivalent to @('takeWhile' p xs, 'dropWhile p xs)@
//span :: (a -> Bool) (Heap a) -> (Heap a, Heap a)
span :== splitWithList o 'L'.span
span :== splitWithList o 'Data.List'.span
// /O(n log n)/. 'takeWhile' applied to a predicate @p@ and a heap @xs@ returns a heap consisting of the
// longest prefix the least elements of @xs@ that satisfy @p@.
......@@ -409,14 +410,14 @@ span :== splitWithList o 'L'.span
// >>> takeWhile (\x -> x `mod` 4 == 0) (fromList [4,8,12,14,16])
// fromList [4,8,12]
//takeWhile :: (a -> Bool) (Heap a) -> Heap a
takeWhile :== withList o 'L'.takeWhile
takeWhile :== withList o 'Data.List'.takeWhile
// /O(n log n)/. 'dropWhile' @p xs@ returns the suffix of the heap remaining after 'takeWhile' @p xs@.
//
// >>> dropWhile (\x -> x `mod` 4 == 0) (fromList [4,8,12,14,16])
// fromList [14,16]
//dropWhile :: (a -> Bool) (Heap a) -> Heap a
dropWhile :== withList o 'L'.dropWhile
dropWhile :== withList o 'Data.List'.dropWhile
// /O(n log n)/. Remove duplicate entries from the heap.
//
......@@ -459,7 +460,7 @@ groupBy f h=:(Heap _ leq t) = insert (insertWith leq x ys) (groupBy f zs)
intersect :: (Heap a) (Heap a) -> Heap a
intersect Empty _ = Empty
intersect _ Empty = Empty
intersect a=:(Heap _ leq _) b = go leq ('DF'.toList a) ('DF'.toList b)
intersect a=:(Heap _ leq _) b = go leq ('Data.Foldable'.toList a) ('Data.Foldable'.toList b)
where
go leq` xxs=:[x:xs] yys=:[y:ys] =
if (leq` x y)
......@@ -474,7 +475,7 @@ intersect a=:(Heap _ leq _) b = go leq ('DF'.toList a) ('DF'.toList b)
intersectWith :: (a a -> b) (Heap a) (Heap a) -> Heap b | Ord b
intersectWith _ Empty _ = Empty
intersectWith _ _ Empty = Empty
intersectWith f a=:(Heap _ leq _) b = go leq f ('DF'.toList a) ('DF'.toList b)
intersectWith f a=:(Heap _ leq _) b = go leq f ('Data.Foldable'.toList a) ('Data.Foldable'.toList b)
where
go :: (a a -> Bool) (a a -> b) [a] [a] -> Heap b | Ord b
go leq` f` xxs=:[x:xs] yys=:[y:ys]
......@@ -488,12 +489,12 @@ intersectWith f a=:(Heap _ leq _) b = go leq f ('DF'.toList a) ('DF'.toList b)
// /O(n log n)/. Traverse the elements of the heap in sorted order and produce a new heap using 'Applicative' side-effects.
//traverse :: (a -> t b) (Heap a) -> t (Heap b) | Applicative t & Ord b
traverseHeap f h :== fmap fromList ('Traversable'.traverse f ('DF'.toList h))
traverseHeap f h :== fmap fromList ('Traversable'.traverse f ('Data.Foldable'.toList h))
// /O(n log n)/. Traverse the elements of the heap in sorted order and produce a new heap using 'Monad'ic side-effects.
//mapM :: (a -> m b) (Heap a) -> m (Heap b) | Monad m & Ord b
//mapM f h = liftM fromList ('Traversable'.mapM f (toList h))
mapMHeap f h :== liftM fromList ('Traversable'.mapM f ('DF'.toList h))
mapMHeap f h :== liftM fromList ('Traversable'.mapM f ('Data.Foldable'.toList h))
//both :: (a -> b) (a, a) -> (b, b)
both f (a, b) :== (f a, f b)
......@@ -628,11 +629,11 @@ splitForest _ _ _ _ = abort "Heap.splitForest: invalid arguments"
withList :: ([a] -> [a]) (Heap a) -> Heap a
withList _ Empty = Empty
withList f hp=:(Heap _ leq _) = fromListWith leq (f ('DF'.toList hp))
withList f hp=:(Heap _ leq _) = fromListWith leq (f ('Data.Foldable'.toList hp))
splitWithList :: ([a] -> ([a], [a])) (Heap a) -> (Heap a, Heap a)
splitWithList _ Empty = (Empty, Empty)
splitWithList f hp=:(Heap _ leq _) = both (fromListWith leq) (f ('DF'.toList hp))
splitWithList f hp=:(Heap _ leq _) = both (fromListWith leq) (f ('Data.Foldable'.toList hp))
// explicit priority/payload tuples
......
implementation module Data.IntMap.Base
from StdFunc import o, const, id
from StdTuple import fst, snd
from StdInt import bitand, bitxor, bitor, >>, bitnot, class + (..), instance + Int, class - (..), instance - Int, instance < Int, instance == Int
from StdOverloaded import class < (..)
from StdMisc import abort
from StdList import instance < [a]
import qualified StdList as SL
from StdTuple import instance < (a,b)
import StdClass
from Control.Monad import class Monad (..)
from Data.Functor import class Functor (..)
from StdBool import class == (..), ||, &&
from Control.Applicative import class Applicative(..)
from Control.Monad import liftM
import qualified Data.Foldable as Foldable
from Data.Maybe import :: Maybe (..), fromMaybe, maybe, instance Functor Maybe, instance Applicative Maybe, instance Monad Maybe
from Data.Either import :: Either (..)
from Data.Monoid import class Monoid(..), class Semigroup (..)
from Data.Functor import <$>
//from Data.Traversable import class Traversable(..)
//import Data.IntSet.Base (Key)
//import qualified Data.IntSet.Base as IntSet
import StdEnv
import Control.Applicative
import Control.Monad
import Data.Either
import Data.Functor
import Data.Functor
import Data.Maybe
import Data.Monoid
// Types
instance Semigroup (IntMap a) where
......
......@@ -8,7 +8,6 @@ from StdFunc import id
from Text.GenJSON import generic JSONEncode, generic JSONDecode, :: JSONNode
from Data.GenEq import generic gEq
from Data.Monoid import class Monoid, class Semigroup
import qualified StdList as SL
from Data.List import foldr
from Data.Functor import class Functor (..)
from Data.IntMap.Base import :: IntMap (..), :: Mask, :: Prefix, minViewWithKey, maxViewWithKey, empty, lookup, instance == (IntMap a), equal
......
......@@ -86,9 +86,9 @@ implementation module Data.IntSet.Base
import StdInt, StdBool, StdFunc, StdMisc, StdOverloaded, StdClass, StdTuple
import Data.GenLexOrd
import qualified Data.List as DL
import Data.Maybe
import Data.Monoid
import qualified Data.List
//import Data.Semigroup
//import Data.Utils.BitUtil
//import Data.Utils.StrictFold
......@@ -306,7 +306,7 @@ deleteBM _ _ Nil = Nil
// | The union of a list of sets.
unions :: [IntSet] -> IntSet
unions xs
= 'DL'.foldl union empty xs
= 'Data.List'.foldl union empty xs
// | /O(n+m)/. The union of two sets.
......@@ -655,7 +655,7 @@ deleteMax s = (maybe Nil snd o maxView) s
// for some =:(x,y)=:, =:x \<> y && f x == f y=:
map :: (Key -> Key) IntSet -> IntSet
map f s = (fromList o 'DL'.map f o toList) s
map f s = (fromList o 'Data.List'.map f o toList) s
/* ------------------------------------------------------------------
Fold
......@@ -760,7 +760,7 @@ toDescList s = foldl (\xs x -> [x:xs]) [] s
// | /O(n*min(n,W))/. Create a set from a list of integers.
fromList :: [Key] -> IntSet
fromList xs
= 'DL'.foldl ins empty xs
= 'Data.List'.foldl ins empty xs
where
ins t x = insert x t
......
......@@ -12,8 +12,7 @@ import Data.GenEq
import Data.Maybe
import Data.Monoid
from Data.Foldable import class Foldable(foldMap)
from Data.Traversable import class Traversable
import qualified Data.Traversable as T
from Data.Traversable import class Traversable(traverse)
import Control.Applicative
import Control.Monad
......@@ -63,8 +62,8 @@ where
traverse f x = foldr cons_f (pure []) x
where cons_f x ys = (\x xs -> [x:xs]) <$> f x <*> ys
mapM f x = mapM f x
sequenceA f = 'T'.traverse id f
sequence x = 'T'.mapM id x
sequenceA f = traverse id f
sequence x = mapM id x
(!?) infixl 9 :: ![.a] !Int -> Maybe .a
(!?) [x:_] 0 = Just x
......
......@@ -13,7 +13,7 @@ from Text.GenJSON import generic JSONEncode, generic JSONDecode, :: JSONNod
from Data.GenEq import generic gEq
from Data.GenLexOrd import generic gLexOrd, :: LexOrd
from Data.Monoid import class Monoid, class Semigroup
import qualified StdList as SL
import qualified StdList
from Data.List import foldr