shake-0.11.7: Build system library, like Make, but more accurate dependencies.

Safe HaskellSafe-Inferred

Development.Shake.Classes

Description

This module reexports the six necessary type classes that every Rule type must support. You can use this module to define new rules without depending on the binary, deepseq and hashable packages.

Synopsis

Documentation

class Show a where

Conversion of values to readable Strings.

Minimal complete definition: showsPrec or show.

Derived instances of Show have the following properties, which are compatible with derived instances of Read:

  • The result of show is a syntactically correct Haskell expression containing only constants, given the fixity declarations in force at the point where the type is declared. It contains only the constructor names defined in the data type, parentheses, and spaces. When labelled constructor fields are used, braces, commas, field names, and equal signs are also used.
  • If the constructor is defined to be an infix operator, then showsPrec will produce infix applications of the constructor.
  • the representation will be enclosed in parentheses if the precedence of the top-level constructor in x is less than d (associativity is ignored). Thus, if d is 0 then the result is never surrounded in parentheses; if d is 11 it is always surrounded in parentheses, unless it is an atomic expression.
  • If the constructor is defined using record syntax, then show will produce the record-syntax form, with the fields given in the same order as the original declaration.

For example, given the declarations

 infixr 5 :^:
 data Tree a =  Leaf a  |  Tree a :^: Tree a

the derived instance of Show is equivalent to

 instance (Show a) => Show (Tree a) where

        showsPrec d (Leaf m) = showParen (d > app_prec) $
             showString "Leaf " . showsPrec (app_prec+1) m
          where app_prec = 10

        showsPrec d (u :^: v) = showParen (d > up_prec) $
             showsPrec (up_prec+1) u .
             showString " :^: "      .
             showsPrec (up_prec+1) v
          where up_prec = 5

Note that right-associativity of :^: is ignored. For example,

  • show (Leaf 1 :^: Leaf 2 :^: Leaf 3) produces the string "Leaf 1 :^: (Leaf 2 :^: Leaf 3)".

Methods

showsPrec

Arguments

:: Int

the operator precedence of the enclosing context (a number from 0 to 11). Function application has precedence 10.

-> a

the value to be converted to a String

-> ShowS 

Convert a value to a readable String.

showsPrec should satisfy the law

 showsPrec d x r ++ s  ==  showsPrec d x (r ++ s)

Derived instances of Read and Show satisfy the following:

That is, readsPrec parses the string produced by showsPrec, and delivers the value that showsPrec started with.

show :: a -> String

A specialised variant of showsPrec, using precedence context zero, and returning an ordinary String.

showList :: [a] -> ShowS

The method showList is provided to allow the programmer to give a specialised way of showing lists of values. For example, this is used by the predefined Show instance of the Char type, where values of type String should be shown in double quotes, rather than between square brackets.

Instances

Show Bool 
Show Char 
Show Double 
Show Float 
Show Int 
Show Int8 
Show Int16 
Show Int32 
Show Int64 
Show Integer 
Show Ordering 
Show Word 
Show Word8 
Show Word16 
Show Word32 
Show Word64 
Show () 
Show Handle 
Show HandleType 
Show Number 
Show Version 
Show DataType 
Show Constr 
Show DataRep 
Show ConstrRep 
Show Fixity 
Show HandlePosn 
Show CDev 
Show CIno 
Show CMode 
Show COff 
Show CPid 
Show CSsize 
Show CGid 
Show CNlink 
Show CUid 
Show CCc 
Show CSpeed 
Show CTcflag 
Show CRLim 
Show Fd 
Show PatternMatchFail 
Show RecSelError 
Show RecConError 
Show RecUpdError 
Show NoMethodError 
Show NonTermination 
Show NestedAtomically 
Show ThreadId 
Show BlockReason 
Show ThreadStatus 
Show BlockedIndefinitelyOnMVar 
Show BlockedIndefinitelyOnSTM 
Show Deadlock 
Show AssertionFailed 
Show AsyncException 
Show ArrayException 
Show ExitCode 
Show IOErrorType 
Show BufferMode 
Show Newline 
Show NewlineMode 
Show TextEncoding 
Show CodingProgress 
Show All 
Show Any 
Show GeneralCategory 
Show CChar 
Show CSChar 
Show CUChar 
Show CShort 
Show CUShort 
Show CInt 
Show CUInt 
Show CLong 
Show CULong 
Show CLLong 
Show CULLong 
Show CFloat 
Show CDouble 
Show CPtrdiff 
Show CSize 
Show CWchar 
Show CSigAtomic 
Show CClock 
Show CTime 
Show CUSeconds 
Show CSUSeconds 
Show CIntPtr 
Show CUIntPtr 
Show CIntMax 
Show CUIntMax 
Show SeekMode 
Show IOMode 
Show Lexeme 
Show MaskingState 
Show IOException 
Show SomeException 
Show ErrorCall 
Show ArithException 
Show TypeRep 
Show TyCon 
Show ByteString 
Show ByteString 
Show IntSet 
Show Permissions 
Show Month 
Show Day 
Show ClockTime 
Show CalendarTime 
Show TimeDiff 
Show StdGen 
Show Text 
Show Text 
Show Padding 
Show DateFormatSpec 
Show LocalTime 
Show ZonedTime 
Show TimeOfDay 
Show TimeZone 
Show UTCTime 
Show NominalDiffTime 
Show Day 
Show DiffTime 
Show Progress 
Show ShakeException 
Show Resource 
Show Verbosity 
Show ShakeOptions 
Show Lint 
Show Assume 
Show CmdOption 
Show a => Show [a] 
(Integral a, Show a) => Show (Ratio a) 
Show (Ptr a) 
Show (FunPtr a) 
HasResolution a => Show (Fixed a) 
Show a => Show (Complex a) 
Show a => Show (Dual a) 
Show a => Show (Sum a) 
Show a => Show (Product a) 
Show a => Show (First a) 
Show a => Show (Last a) 
Show a => Show (Maybe a) 
Show a => Show (Tree a) 
Show a => Show (Seq a) 
Show a => Show (ViewL a) 
Show a => Show (ViewR a) 
Show a => Show (IntMap a) 
Show a => Show (Set a) 
Show a => Show (HashSet a) 
(Show a, Show b) => Show (Either a b) 
(Show a, Show b) => Show (a, b) 
(Ix ix, Show ix, Show e, IArray UArray e) => Show (UArray ix e) 
(Ix a, Show a, Show b) => Show (Array a b) 
(Show k, Show a) => Show (Map k a) 
(Show k, Show v) => Show (HashMap k v) 
(Show a, Show b, Show c) => Show (a, b, c) 
(Show a, Show b, Show c, Show d) => Show (a, b, c, d) 
(Show a, Show b, Show c, Show d, Show e) => Show (a, b, c, d, e) 
(Show a, Show b, Show c, Show d, Show e, Show f) => Show (a, b, c, d, e, f) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g) => Show (a, b, c, d, e, f, g) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h) => Show (a, b, c, d, e, f, g, h) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i) => Show (a, b, c, d, e, f, g, h, i) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j) => Show (a, b, c, d, e, f, g, h, i, j) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k) => Show (a, b, c, d, e, f, g, h, i, j, k) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l) => Show (a, b, c, d, e, f, g, h, i, j, k, l) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 
(Show a, Show b, Show c, Show d, Show e, Show f, Show g, Show h, Show i, Show j, Show k, Show l, Show m, Show n, Show o) => Show (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 

class Typeable a where

The class Typeable allows a concrete representation of a type to be calculated.

Methods

typeOf :: a -> TypeRep

Takes a value of type a and returns a concrete representation of that type. The value of the argument should be ignored by any instance of Typeable, so that it is safe to pass undefined as the argument.

Instances

Typeable Bool 
Typeable Char 
Typeable Double 
Typeable Float 
Typeable Int 
Typeable Int8 
Typeable Int16 
Typeable Int32 
Typeable Int64 
Typeable Integer 
Typeable Ordering 
Typeable RealWorld 
Typeable Word 
Typeable Word8 
Typeable Word16 
Typeable Word32 
Typeable Word64 
Typeable () 
Typeable Handle 
Typeable Handle__ 
Typeable Version 
Typeable E0 
Typeable E1 
Typeable E2 
Typeable E3 
Typeable E6 
Typeable E9 
Typeable E12 
Typeable SpecConstrAnnotation 
Typeable CDev 
Typeable CIno 
Typeable CMode 
Typeable COff 
Typeable CPid 
Typeable CSsize 
Typeable CGid 
Typeable CNlink 
Typeable CUid 
Typeable CCc 
Typeable CSpeed 
Typeable CTcflag 
Typeable CRLim 
Typeable Fd 
Typeable PatternMatchFail 
Typeable RecSelError 
Typeable RecConError 
Typeable RecUpdError 
Typeable NoMethodError 
Typeable NonTermination 
Typeable NestedAtomically 
Typeable ThreadId 
Typeable BlockedIndefinitelyOnMVar 
Typeable BlockedIndefinitelyOnSTM 
Typeable Deadlock 
Typeable AssertionFailed 
Typeable AsyncException 
Typeable ArrayException 
Typeable ExitCode 
Typeable CChar 
Typeable CSChar 
Typeable CUChar 
Typeable CShort 
Typeable CUShort 
Typeable CInt 
Typeable CUInt 
Typeable CLong 
Typeable CULong 
Typeable CLLong 
Typeable CULLong 
Typeable CFloat 
Typeable CDouble 
Typeable CPtrdiff 
Typeable CSize 
Typeable CWchar 
Typeable CSigAtomic 
Typeable CClock 
Typeable CTime 
Typeable CUSeconds 
Typeable CSUSeconds 
Typeable CIntPtr 
Typeable CUIntPtr 
Typeable CIntMax 
Typeable CUIntMax 
Typeable IOException 
Typeable SomeException 
Typeable ErrorCall 
Typeable ArithException 
Typeable TypeRep 
Typeable TyCon 
Typeable ByteString 
Typeable ByteString 
Typeable IntSet 
Typeable Text 
Typeable Text 
Typeable LocalTime 
Typeable ZonedTime 
Typeable TimeOfDay 
Typeable TimeZone 
Typeable UTCTime 
Typeable NominalDiffTime 
Typeable Day 
Typeable UniversalTime 
Typeable DiffTime 
Typeable Progress 
Typeable ShakeException 
Typeable Verbosity 
Typeable ShakeOptions 
Typeable Lint 
Typeable Assume 
(Typeable1 s, Typeable a) => Typeable (s a)

One Typeable instance for all Typeable1 instances

class Eq a where

The Eq class defines equality (==) and inequality (/=). All the basic datatypes exported by the Prelude are instances of Eq, and Eq may be derived for any datatype whose constituents are also instances of Eq.

Minimal complete definition: either == or /=.

Methods

(==) :: a -> a -> Bool

(/=) :: a -> a -> Bool

Instances

Eq Bool 
Eq Char 
Eq Double 
Eq Float 
Eq Int 
Eq Int8 
Eq Int16 
Eq Int32 
Eq Int64 
Eq Integer 
Eq Ordering 
Eq Word 
Eq Word8 
Eq Word16 
Eq Word32 
Eq Word64 
Eq () 
Eq Handle 
Eq Number 
Eq Version 
Eq SpecConstrAnnotation 
Eq Constr

Equality of constructors

Eq DataRep 
Eq ConstrRep 
Eq Fixity 
Eq HandlePosn 
Eq CDev 
Eq CIno 
Eq CMode 
Eq COff 
Eq CPid 
Eq CSsize 
Eq CGid 
Eq CNlink 
Eq CUid 
Eq CCc 
Eq CSpeed 
Eq CTcflag 
Eq CRLim 
Eq Fd 
Eq ThreadId 
Eq BlockReason 
Eq ThreadStatus 
Eq Errno 
Eq AsyncException 
Eq ArrayException 
Eq ExitCode 
Eq IOErrorType 
Eq BufferMode 
Eq Newline 
Eq NewlineMode 
Eq CodingProgress 
Eq All 
Eq Any 
Eq TypeRepKey 
Eq GeneralCategory 
Eq CChar 
Eq CSChar 
Eq CUChar 
Eq CShort 
Eq CUShort 
Eq CInt 
Eq CUInt 
Eq CLong 
Eq CULong 
Eq CLLong 
Eq CULLong 
Eq CFloat 
Eq CDouble 
Eq CPtrdiff 
Eq CSize 
Eq CWchar 
Eq CSigAtomic 
Eq CClock 
Eq CTime 
Eq CUSeconds 
Eq CSUSeconds 
Eq CIntPtr 
Eq CUIntPtr 
Eq CIntMax 
Eq CUIntMax 
Eq IODeviceType 
Eq SeekMode 
Eq IOMode 
Eq Lexeme 
Eq MaskingState 
Eq IOException 
Eq ArithException 
Eq TypeRep 
Eq TyCon 
Eq ByteString 
Eq ByteString 
Eq IntSet 
Eq Permissions 
Eq Month 
Eq Day 
Eq ClockTime 
Eq CalendarTime 
Eq TimeDiff 
Eq Text 
Eq Text 
Eq LocalTime 
Eq TimeOfDay 
Eq TimeZone 
Eq UTCTime 
Eq NominalDiffTime 
Eq Day 
Eq UniversalTime 
Eq DiffTime 
Eq Progress 
Eq Resource 
Eq Verbosity 
Eq Lint 
Eq Assume 
Eq CmdOption 
Eq a => Eq [a] 
Eq a => Eq (Ratio a) 
Eq (Ptr a) 
Eq (FunPtr a) 
Eq (StableName a) 
Eq (Fixed a) 
Eq a => Eq (Complex a) 
Eq (Chan a) 
Eq (TVar a) 
Eq a => Eq (Dual a) 
Eq a => Eq (Sum a) 
Eq a => Eq (Product a) 
Eq a => Eq (First a) 
Eq a => Eq (Last a) 
Eq (IORef a) 
Eq (MVar a) 
Eq a => Eq (Maybe a) 
Eq a => Eq (Tree a) 
Eq a => Eq (Seq a) 
Eq a => Eq (ViewL a) 
Eq a => Eq (ViewR a) 
Eq a => Eq (IntMap a) 
Eq a => Eq (Set a) 
(Hashable a, Eq a) => Eq (HashSet a) 
(Eq a, Eq b) => Eq (Either a b) 
(Eq a, Eq b) => Eq (a, b) 
(Ix ix, Eq e, IArray UArray e) => Eq (UArray ix e) 
(Ix i, Eq e) => Eq (Array i e) 
(Eq k, Eq a) => Eq (Map k a) 
(Eq k, Eq v) => Eq (Leaf k v) 
(Eq k, Eq v) => Eq (HashMap k v) 
(Eq a, Eq b, Eq c) => Eq (a, b, c) 
Eq (STUArray s i e) 
Eq (STArray s i e) 
(Eq a, Eq b, Eq c, Eq d) => Eq (a, b, c, d) 
(Eq a, Eq b, Eq c, Eq d, Eq e) => Eq (a, b, c, d, e) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f) => Eq (a, b, c, d, e, f) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g) => Eq (a, b, c, d, e, f, g) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h) => Eq (a, b, c, d, e, f, g, h) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i) => Eq (a, b, c, d, e, f, g, h, i) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j) => Eq (a, b, c, d, e, f, g, h, i, j) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k) => Eq (a, b, c, d, e, f, g, h, i, j, k) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l) => Eq (a, b, c, d, e, f, g, h, i, j, k, l) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n) 
(Eq a, Eq b, Eq c, Eq d, Eq e, Eq f, Eq g, Eq h, Eq i, Eq j, Eq k, Eq l, Eq m, Eq n, Eq o) => Eq (a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) 

class Hashable a where

The class of types that can be converted to a hash value.

Minimal implementation: hashWithSalt.

Methods

hashWithSalt :: Int -> a -> Int

Return a hash value for the argument, using the given salt.

The general contract of hashWithSalt is:

  • If two values are equal according to the == method, then applying the hashWithSalt method on each of the two values must produce the same integer result if the same salt is used in each case.
  • It is not required that if two values are unequal according to the == method, then applying the hashWithSalt method on each of the two values must produce distinct integer results. However, the programmer should be aware that producing distinct integer results for unequal values may improve the performance of hashing-based data structures.
  • This method can be used to compute different hash values for the same input by providing a different salt in each application of the method. This implies that any instance that defines hashWithSalt must make use of the salt in its implementation.

hash :: a -> Int

Like hashWithSalt, but no salt is used. The default implementation uses hashWithSalt with some default salt. Instances might want to implement this method to provide a more efficient implementation than the default implementation.

class Binary t where

The Binary class provides put and get, methods to encode and decode a Haskell value to a lazy ByteString. It mirrors the Read and Show classes for textual representation of Haskell types, and is suitable for serialising Haskell values to disk, over the network.

For parsing and generating simple external binary formats (e.g. C structures), Binary may be used, but in general is not suitable for complex protocols. Instead use the Put and Get primitives directly.

Instances of Binary should satisfy the following property:

 decode . encode == id

That is, the get and put methods should be the inverse of each other. A range of instances are provided for basic Haskell types.

Methods

put :: t -> Put

Encode a value in the Put monad.

get :: Get t

Decode a value in the Get monad

Instances

Binary Bool 
Binary Char 
Binary Double 
Binary Float 
Binary Int 
Binary Int8 
Binary Int16 
Binary Int32 
Binary Int64 
Binary Integer 
Binary Ordering 
Binary Word 
Binary Word8 
Binary Word16 
Binary Word32 
Binary Word64 
Binary () 
Binary ByteString 
Binary ByteString 
Binary IntSet 
Binary a => Binary [a] 
(Binary a, Integral a) => Binary (Ratio a) 
Binary a => Binary (Maybe a) 
Binary e => Binary (Tree e) 
Binary e => Binary (Seq e) 
Binary e => Binary (IntMap e) 
(Ord a, Binary a) => Binary (Set a) 
(Binary a, Binary b) => Binary (Either a b) 
(Binary a, Binary b) => Binary (a, b) 
(Binary i, Ix i, Binary e, IArray UArray e) => Binary (UArray i e) 
(Binary i, Ix i, Binary e) => Binary (Array i e) 
(Ord k, Binary k, Binary e) => Binary (Map k e) 
(Binary a, Binary b, Binary c) => Binary (a, b, c) 
(Binary a, Binary b, Binary c, Binary d) => Binary (a, b, c, d) 
(Binary a, Binary b, Binary c, Binary d, Binary e) => Binary (a, b, c, d, e) 
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f) => Binary (a, b, c, d, e, f) 
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g) => Binary (a, b, c, d, e, f, g) 
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h) => Binary (a, b, c, d, e, f, g, h) 
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h, Binary i) => Binary (a, b, c, d, e, f, g, h, i) 
(Binary a, Binary b, Binary c, Binary d, Binary e, Binary f, Binary g, Binary h, Binary i, Binary j) => Binary (a, b, c, d, e, f, g, h, i, j) 

class NFData a where

A class of types that can be fully evaluated.

Methods

rnf :: a -> ()

rnf should reduce its argument to normal form (that is, fully evaluate all sub-components), and then return '()'.

The default implementation of rnf is

 rnf a = a `seq` ()

which may be convenient when defining instances for data types with no unevaluated fields (e.g. enumerations).

Instances

NFData Bool 
NFData Char 
NFData Double 
NFData Float 
NFData Int 
NFData Int8 
NFData Int16 
NFData Int32 
NFData Int64 
NFData Integer 
NFData Word 
NFData Word8 
NFData Word16 
NFData Word32 
NFData Word64 
NFData () 
NFData Version 
NFData ByteString 
NFData ByteString 
NFData IntSet 
NFData Text 
NFData Text 
NFData LocalTime 
NFData ZonedTime 
NFData TimeOfDay 
NFData TimeZone 
NFData UTCTime 
NFData NominalDiffTime 
NFData Day 
NFData UniversalTime 
NFData DiffTime 
NFData a => NFData [a] 
(Integral a, NFData a) => NFData (Ratio a) 
NFData (Fixed a) 
(RealFloat a, NFData a) => NFData (Complex a) 
NFData a => NFData (Maybe a) 
NFData a => NFData (Digit a) 
NFData a => NFData (Node a) 
NFData a => NFData (Elem a) 
NFData a => NFData (FingerTree a) 
NFData a => NFData (Tree a) 
NFData a => NFData (Seq a) 
NFData a => NFData (IntMap a) 
NFData a => NFData (Set a) 
NFData a => NFData (HashSet a) 
NFData (a -> b)

This instance is for convenience and consistency with seq. This assumes that WHNF is equivalent to NF for functions.

(NFData a, NFData b) => NFData (Either a b) 
(NFData a, NFData b) => NFData (a, b) 
(Ix a, NFData a, NFData b) => NFData (Array a b) 
(NFData k, NFData a) => NFData (Map k a) 
(NFData k, NFData v) => NFData (Leaf k v) 
(NFData k, NFData v) => NFData (HashMap k v) 
(NFData a, NFData b, NFData c) => NFData (a, b, c) 
(NFData a, NFData b, NFData c, NFData d) => NFData (a, b, c, d) 
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5) => NFData (a1, a2, a3, a4, a5) 
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6) => NFData (a1, a2, a3, a4, a5, a6) 
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7) => NFData (a1, a2, a3, a4, a5, a6, a7) 
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8) => NFData (a1, a2, a3, a4, a5, a6, a7, a8) 
(NFData a1, NFData a2, NFData a3, NFData a4, NFData a5, NFData a6, NFData a7, NFData a8, NFData a9) => NFData (a1, a2, a3, a4, a5, a6, a7, a8, a9)