Commit cb86d7b8 authored by Kai-Oliver Prott's avatar Kai-Oliver Prott
Browse files

Update Guide

parent 5c427e82
......@@ -73,9 +73,10 @@ Random -> System.Random
Function -> Data.Function (on, fix)
bzw Data.Tuple.Extra (first, second, (***), (&&&), both)
Prelude -> Removed Either type
Prelude -> added pi, ^, <$>, <$
State -> Control.Monad.Trans.State, now with monad transformer
has Applicative instance
Renames:
bindS -> Monad instance, >>=
bindS_ -> Monad instance, >>
......@@ -95,13 +96,14 @@ ErrorState -> removed, use Control.Monad.Trans.Error
Renames:
returnES -> Monad instance, return
>+= -> Monad instance, >>=
>+ -> *>
>+ -> >>
getS -> lift . get
putS -> lift . put
modifyS -> lift . modify
mapS -> mapM
concatMapES -> concatMapM
mapAccumES -> mapAccumM
concatMapES -> Control.Monad.Extra.concatMapM
mapAccumES -> Control.Monad.Extra.mapAccumM
<*>,<*, -> Applicative instance
AnsiCodes -> System.Console.ANSI.Codes
......@@ -154,7 +156,6 @@ unsetEnviron -> unsetEnv
getEnviron -> getEnv | Note: getEnvironment was added, but has a different purpose
setEnviron -> setEnv
FunctionInversion -> Data.Function.Inversion
TableRBT -> Data.Table.RBTree
......@@ -163,7 +164,7 @@ Renames: removed TableRBT suffix
SetRBT -> Data.Set.RBTree
Renames: removed SetRBT suffix
ReadNumeric -> Numeric
ReadNumeric -> Numeric | Note: Types changed
Debug -> Debug.Trace
......@@ -171,6 +172,8 @@ Profile -> Debug.Profile
Time -> Data.Time
Integer -> removed
Integer -> removed, important functions integrated in prelude
Float -> removed, important functions integrated in prelude
Float -> removed
Read -> use read instance
AllSolutions
Array
COmbinatorial
Distribution
Findall
IOExts
Combinatorial, Findall & Konsorten
PropertyFile (wird in Distribution genutzt)
Format
SearchTree
Shows, Reads
ValueSequence
Distribution
Array
Traversal
ReadShowTerm
SCC
SearchTree
SetFunctions
ShowS
Sort
Traversal
ValueSequence
--------------------------------------------------------------------------------
--- This library provides a type and combinators for show functions using
--- functional lists.
---
--- @author Bjoern Peemoeller
--- @version April 2016
--- @category general
--------------------------------------------------------------------------------
module ShowS ( ShowS
, showString, showChar, showParen, shows
, space, nl, sep, replicateS, concatS
) where
import Test.Prop
type ShowS = String -> String
--- Prepend a string
showString :: String -> ShowS
showString s = (s ++)
showStringIsString s = showString s [] -=- s
showStringConcat s1 s2 = (showString s1 . showString s2) [] -=- s1++s2
--- Prepend a single character
showChar :: Char -> ShowS
showChar c = (c:)
--- Surround the inner show function with parentheses if the first argument
--- evaluates to `True`.
showParen :: Bool -> ShowS -> ShowS
showParen True s = showChar '(' . s . showChar ')'
showParen False s = s
--- Convert a value to `ShowS` using the standard show function.
shows :: Show a => a -> ShowS
shows = showString . show
--- Prepend a space
space :: ShowS
space = showChar ' '
--- Prepend a newline
nl :: ShowS
nl = showChar '\n'
--- Separate a list of `ShowS`
sep :: ShowS -> [ShowS] -> ShowS
sep _ [] = id
sep s xs@(_:_) = foldr1 (\ f g -> f . s . g) xs
--- Replicate a `ShowS` a given number of times
replicateS :: Int -> ShowS -> ShowS
replicateS n funcS
| n <= 0 = id
| otherwise = funcS . replicateS (n - 1) funcS
replicateSIsConRep n s =
n>=0 ==> replicateS n (showString s) [] -=- concat (replicate n s)
--- Concatenate a list of `ShowS`
concatS :: [ShowS] -> ShowS
concatS [] = id
concatS xs@(_:_) = foldr1 (\ f g -> f . g) xs
concatSIsConcat xs = concatS (map showString xs) [] -=- concat xs
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