base-prelude-0.1.11: The most complete prelude formed from only the "base" package

Safe HaskellNone
LanguageHaskell2010

BasePrelude

Contents

Description

This module reexports most of the definitions from the "base" package, which are meant to be imported unqualified.

For details check out the source.

Synopsis

Reimplementations of functions presented in versions of "base" newer than 4.5

Data.Bool

bool :: a -> a -> Bool -> a Source

Case analysis for the Bool type. bool a b p evaluates to a when p is False, and evaluates to b when p is True.

Debug.Trace

traceShowId :: Show a => a -> a Source

Like traceShow but returns the shown value instead of a third value.

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

Like trace but returning unit in an arbitrary monad. Allows for convenient use in do-notation. Note that the application of trace is not an action in the monad, as traceIO is in the IO monad.

... = do
  x <- ...
  traceM $ "x: " ++ show x
  y <- ...
  traceM $ "y: " ++ show y

traceShowM :: (Show a, Monad m) => a -> m () Source

Like traceM, but uses show on the argument to convert it to a String.

... = do
  x <- ...
  traceShowM $ x
  y <- ...
  traceShowM $ x + y

Data.Ord

newtype Down a Source

The Down type allows you to reverse sort order conveniently. A value of type Down a contains a value of type a (represented as Down a). If a has an Ord instance associated with it then comparing two values thus wrapped will give you the opposite of their normal sort order. This is particularly useful when sorting in generalised list comprehensions, as in: then sortWith by Down x

Constructors

Down a 

Instances

Eq a => Eq (Down a) 
Ord a => Ord (Down a) 
Read a => Read (Down a) 
Show a => Show (Down a) 

Text.Read

readEither :: Read a => String -> Either String a Source

Parse a string using the Read instance. Succeeds if there is exactly one valid result. A Left value indicates a parse error.

readMaybe :: Read a => String -> Maybe a Source

Parse a string using the Read instance. Succeeds if there is exactly one valid result.