MiniAgda
Safe HaskellNone
LanguageHaskell98

Util

Synopsis

Documentation

(<.>) :: Functor m => (b -> c) -> (a -> m b) -> a -> m c infixr 9 Source #

Composition: pure function after monadic function.

(==<<) :: Monad m => (a -> b -> m c) -> (m a, m b) -> m c Source #

Binary version of =<<.

andLazy :: Monad m => m Bool -> m Bool -> m Bool Source #

andM :: Monad m => [m Bool] -> m Bool Source #

compAssoc :: Eq b => [(a, b)] -> [(b, c)] -> [(a, c)] Source #

findM :: Monad m => (a -> m Bool) -> [a] -> m (Maybe a) Source #

firstJustM :: Monad m => [m (Maybe a)] -> m (Maybe a) Source #

for :: Functor f => f a -> (a -> b) -> f b Source #

fwhen :: Bool -> (a -> a) -> a -> a Source #

Apply when condition is True.

hasDuplicate :: Eq a => [a] -> Bool Source #

headMaybe :: [a] -> Maybe a Source #

hsepBy :: Doc -> [Doc] -> Doc Source #

ifJustM :: Monad m => m (Maybe a) -> (a -> m b) -> m b -> m b Source #

ifM :: Monad m => m Bool -> m a -> m a -> m a Source #

ifNothingM :: Monad m => m (Maybe a) -> m b -> (a -> m b) -> m b Source #

mapAssoc :: (a -> b) -> [(n, a)] -> [(n, b)] Source #

mapAssocM :: (Applicative m, Monad m) => (a -> m b) -> [(n, a)] -> m [(n, b)] Source #

mapFst :: (a -> c) -> (a, d) -> (c, d) Source #

mapMapM :: (Monad m, Ord k) => (a -> m b) -> Map k a -> m (Map k b) Source #

mapOver :: Functor f => f a -> (a -> b) -> f b Source #

mapPair :: (a -> c) -> (b -> d) -> (a, b) -> (c, d) Source #

mapSnd :: (b -> d) -> (a, b) -> (a, d) Source #

showList :: String -> (a -> String) -> [a] -> String Source #

traceM :: Monad m => String -> m () Source #

unlessM :: Monad m => m Bool -> m () -> m () Source #

whenJust :: Monad m => Maybe a -> (a -> m ()) -> m () Source #

whenJustM :: Monad m => m (Maybe a) -> (a -> m ()) -> m () Source #

whenM :: Monad m => m Bool -> m () -> m () Source #

whenNothing :: Monad m => Maybe a -> m () -> m () Source #

zipPair :: (a -> b -> c) -> (d -> e -> f) -> (a, d) -> (b, e) -> (c, f) Source #

class Null a where Source #

Methods

null :: a -> Bool Source #

Instances

Instances details
Null Telescope Source # 
Instance details

Defined in Abstract

Methods

null :: Telescope -> Bool Source #

Null [a] Source # 
Instance details

Defined in Util

Methods

null :: [a] -> Bool Source #

class Pretty a where Source #

Minimal complete definition

Nothing

Methods

pretty :: a -> Doc Source #

prettyPrec :: Int -> a -> Doc Source #

Instances

Instances details
Pretty DefId Source # 
Instance details

Defined in Abstract

Pretty Expr Source # 
Instance details

Defined in Abstract

Pretty LtLe Source # 
Instance details

Defined in Abstract

Pretty Name Source # 
Instance details

Defined in Abstract

Pretty Pattern Source # 
Instance details

Defined in Abstract

Pretty PiSigma Source # 
Instance details

Defined in Abstract

Pretty QName Source # 
Instance details

Defined in Abstract

Pretty TBind Source # 
Instance details

Defined in Abstract

Pretty Telescope Source # 
Instance details

Defined in Abstract

Pretty Doc Source # 
Instance details

Defined in Util

Methods

pretty :: Doc -> Doc Source #

prettyPrec :: Int -> Doc -> Doc Source #

Pretty (Bound Expr) Source # 
Instance details

Defined in Abstract

Pretty (Measure Expr) Source # 
Instance details

Defined in Abstract

Pretty (Sort Expr) Source # 
Instance details

Defined in Abstract

Pretty a => Pretty (Tagged a) Source # 
Instance details

Defined in Abstract

Methods

pretty :: Tagged a -> Doc Source #

prettyPrec :: Int -> Tagged a -> Doc Source #

class Push a b where Source #

Methods

push :: a -> b -> b Source #

Instances

Instances details
Push a [[a]] Source # 
Instance details

Defined in Util

Methods

push :: a -> [[a]] -> [[a]] Source #

Push a [a] Source # 
Instance details

Defined in Util

Methods

push :: a -> [a] -> [a] Source #

class Retrieve a b c | b -> c where Source #

Methods

retrieve :: a -> b -> Maybe c Source #

Instances

Instances details
Retrieve a [(a, b)] b Source # 
Instance details

Defined in Util

Methods

retrieve :: a -> [(a, b)] -> Maybe b Source #

Retrieve a [[(a, b)]] b Source # 
Instance details

Defined in Util

Methods

retrieve :: a -> [[(a, b)]] -> Maybe b Source #

class Size a where Source #

Methods

size :: a -> Int Source #

Instances

Instances details
Size Telescope Source # 
Instance details

Defined in Abstract

Methods

size :: Telescope -> Int Source #

Size [a] Source # 
Instance details

Defined in Util

Methods

size :: [a] -> Int Source #

intercalate :: [a] -> [[a]] -> [a] #

intercalate xs xss is equivalent to (concat (intersperse xs xss)). It inserts the list xs in between the lists in xss and concatenates the result.

Laziness

Expand

intercalate has the following properties:

>>> take 5 (intercalate undefined ("Lorem" : undefined))
"Lorem"
>>> take 6 (intercalate ", " ("Lorem" : undefined))
"Lorem*** Exception: Prelude.undefined

Examples

Expand
>>> intercalate ", " ["Lorem", "ipsum", "dolor"]
"Lorem, ipsum, dolor"
>>> intercalate [0, 1] [[2, 3], [4, 5, 6], []]
[2,3,0,1,4,5,6,0,1]
>>> intercalate [1, 2, 3] [[], []]
[1,2,3]