-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | The base package for Fay. -- -- The base package for Fay. This package amongst others exports Prelude -- and FFI which you probably want to use with Fay. @package fay-base @version 0.19.2 module Data.Data -- | The Data class comprehends a fundamental primitive -- gfoldl for folding over constructor applications, say terms. -- This primitive can be instantiated in several ways to map over the -- immediate subterms of a term; see the gmap combinators later -- in this class. Indeed, a generic programmer does not necessarily need -- to use the ingenious gfoldl primitive but rather the intuitive -- gmap combinators. The gfoldl primitive is completed by -- means to query top-level constructors, to turn constructor -- representations into proper terms, and to list all possible datatype -- constructors. This completion allows us to serve generic programming -- scenarios like read, show, equality, term generation. -- -- The combinators gmapT, gmapQ, gmapM, etc are all -- provided with default definitions in terms of gfoldl, leaving -- open the opportunity to provide datatype-specific definitions. (The -- inclusion of the gmap combinators as members of class -- Data allows the programmer or the compiler to derive -- specialised, and maybe more efficient code per datatype. Note: -- gfoldl is more higher-order than the gmap combinators. -- This is subject to ongoing benchmarking experiments. It might turn out -- that the gmap combinators will be moved out of the class -- Data.) -- -- Conceptually, the definition of the gmap combinators in terms -- of the primitive gfoldl requires the identification of the -- gfoldl function arguments. Technically, we also need to -- identify the type constructor c for the construction of the -- result type from the folded term type. -- -- In the definition of gmapQx combinators, we use -- phantom type constructors for the c in the type of -- gfoldl because the result type of a query does not involve the -- (polymorphic) type of the term argument. In the definition of -- gmapQl we simply use the plain constant type constructor -- because gfoldl is left-associative anyway and so it is readily -- suited to fold a left-associative binary operation over the immediate -- subterms. In the definition of gmapQr, extra effort is needed. We use -- a higher-order accumulation trick to mediate between left-associative -- constructor application vs. right-associative binary operation (e.g., -- (:)). When the query is meant to compute a value of type -- r, then the result type withing generic folding is r -- -> r. So the result of folding is a function to which we -- finally pass the right unit. -- -- With the -XDeriveDataTypeable option, GHC can generate -- instances of the Data class automatically. For example, given -- the declaration -- --
--   data T a b = C1 a b | C2 deriving (Typeable, Data)
--   
-- -- GHC will generate an instance that is equivalent to -- --
--   instance (Data a, Data b) => Data (T a b) where
--       gfoldl k z (C1 a b) = z C1 `k` a `k` b
--       gfoldl k z C2       = z C2
--   
--       gunfold k z c = case constrIndex c of
--                           1 -> k (k (z C1))
--                           2 -> z C2
--   
--       toConstr (C1 _ _) = con_C1
--       toConstr C2       = con_C2
--   
--       dataTypeOf _ = ty_T
--   
--   con_C1 = mkConstr ty_T "C1" [] Prefix
--   con_C2 = mkConstr ty_T "C2" [] Prefix
--   ty_T   = mkDataType "Module.T" [con_C1, con_C2]
--   
-- -- This is suitable for datatypes that are exported transparently. class Typeable a => Data a -- | The class Typeable allows a concrete representation of a type -- to be calculated. class Typeable a module Prelude -- | The character type Char is an enumeration whose values -- represent Unicode (or equivalently ISO/IEC 10646) characters (see -- http://www.unicode.org/ for details). This set extends the ISO -- 8859-1 (Latin-1) character set (the first 256 characters), which is -- itself an extension of the ASCII character set (the first 128 -- characters). A character literal in Haskell has type Char. -- -- To convert a Char to or from the corresponding Int value -- defined by Unicode, use toEnum and fromEnum from the -- Enum class respectively (or equivalently ord and -- chr). data Char :: * -- | A String is a list of characters. String constants in Haskell -- are values of type String. type String = [Char] -- | Double-precision floating point numbers. It is desirable that this -- type be at least equal in range and precision to the IEEE -- double-precision type. data Double :: * -- | A fixed-precision integer type with at least the range [-2^29 .. -- 2^29-1]. The exact range for a given implementation can be -- determined by using minBound and maxBound from the -- Bounded class. data Int :: * -- | Arbitrary-precision integers. data Integer :: * data Bool :: * False :: Bool True :: Bool -- | Parsing of Strings, producing values. -- -- Minimal complete definition: readsPrec (or, for GHC only, -- readPrec) -- -- Derived instances of Read make the following assumptions, which -- derived instances of Show obey: -- -- -- -- For example, given the declarations -- --
--   infixr 5 :^:
--   data Tree a =  Leaf a  |  Tree a :^: Tree a
--   
-- -- the derived instance of Read in Haskell 98 is equivalent to -- --
--   instance (Read a) => Read (Tree a) where
--   
--           readsPrec d r =  readParen (d > app_prec)
--                            (\r -> [(Leaf m,t) |
--                                    ("Leaf",s) <- lex r,
--                                    (m,t) <- readsPrec (app_prec+1) s]) r
--   
--                         ++ readParen (d > up_prec)
--                            (\r -> [(u:^:v,w) |
--                                    (u,s) <- readsPrec (up_prec+1) r,
--                                    (":^:",t) <- lex s,
--                                    (v,w) <- readsPrec (up_prec+1) t]) r
--   
--             where app_prec = 10
--                   up_prec = 5
--   
-- -- Note that right-associativity of :^: is unused. -- -- The derived instance in GHC is equivalent to -- --
--   instance (Read a) => Read (Tree a) where
--   
--           readPrec = parens $ (prec app_prec $ do
--                                    Ident "Leaf" <- lexP
--                                    m <- step readPrec
--                                    return (Leaf m))
--   
--                        +++ (prec up_prec $ do
--                                    u <- step readPrec
--                                    Symbol ":^:" <- lexP
--                                    v <- step readPrec
--                                    return (u :^: v))
--   
--             where app_prec = 10
--                   up_prec = 5
--   
--           readListPrec = readListPrecDefault
--   
class Read a -- | 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: -- -- -- -- 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, -- -- class Show a -- | 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 /=. class Eq a (==) :: Eq a => a -> a -> Bool (/=) :: Eq a => a -> a -> Bool (==) :: Eq a => a -> a -> Bool (/=) :: Eq a => a -> a -> Bool -- | The Maybe type encapsulates an optional value. A value of type -- Maybe a either contains a value of type a -- (represented as Just a), or it is empty (represented -- as Nothing). Using Maybe is a good way to deal with -- errors or exceptional cases without resorting to drastic measures such -- as error. -- -- The Maybe type is also a monad. It is a simple kind of error -- monad, where all errors are represented by Nothing. A richer -- error monad can be built using the Either type. data Maybe a :: * -> * Nothing :: Maybe a Just :: a -> Maybe a -- | Maybe type. -- -- Either type. maybe :: t -> (t1 -> t) -> Maybe t1 -> t -- | Monomorphic bind for Fay. (>>=) :: Ptr (Fay a) -> Ptr (a -> Fay b) -> Ptr (Fay b) -- | Monomorphic then for Fay. (>>) :: Ptr (Fay a) -> Ptr (Fay b) -> Ptr (Fay b) -- | Monomorphic return for Fay. return :: a -> Fay a fail :: String -> Fay a when :: Bool -> Fay a -> Fay () unless :: Bool -> Fay a -> Fay () forM :: [a] -> (a -> Fay b) -> Fay [b] forM_ :: [a] -> (a -> Fay b) -> Fay () mapM :: (a -> Fay b) -> [a] -> Fay [b] mapM_ :: (a -> Fay b) -> [a] -> Fay () (=<<) :: (a -> Fay b) -> Fay a -> Fay b -- | Evaluate each action in the sequence from left to right, and collect -- the results. sequence :: [Fay a] -> Fay [a] sequence_ :: [Fay a] -> Fay () void :: Fay a -> Fay () (>=>) :: (a -> Fay b) -> (b -> Fay c) -> a -> Fay c (<=<) :: (b -> Fay c) -> (a -> Fay b) -> a -> Fay c (*) :: Num a => a -> a -> a (+) :: Num a => a -> a -> a (-) :: Num a => a -> a -> a class Eq a => Ord a (<) :: Ord a => a -> a -> Bool (<=) :: Ord a => a -> a -> Bool (>) :: Ord a => a -> a -> Bool (>=) :: Ord a => a -> a -> Bool data Ordering :: * LT :: Ordering EQ :: Ordering GT :: Ordering compare :: Ord a => a -> a -> Ordering succ :: Num a => a -> a pred :: Num a => a -> a enumFrom :: Num a => a -> [a] enumFromTo :: (Ord t, Num t) => t -> t -> [t] enumFromBy :: Num t => t -> t -> [t] enumFromThen :: Num t => t -> t -> [t] enumFromByTo :: (Ord t, Num t) => t -> t -> t -> [t] enumFromThenTo :: (Ord t, Num t) => t -> t -> t -> [t] (/) :: Fractional a => a -> a -> a fromIntegral :: (Num a, Num b) => Ptr a -> Ptr b fromInteger :: Num a => Ptr Integer -> Ptr a -- | Boolean "and" (&&) :: Bool -> Bool -> Bool -- | Boolean "or" (||) :: Bool -> Bool -> Bool not :: Bool -> Bool otherwise :: Bool -- | Uses JSON.stringify. show :: Automatic a -> String -- | Throws a JavaScript error. error :: String -> a -- | Throws undefined via error. undefined :: a -- | The Either type represents values with two possibilities: a -- value of type Either a b is either Left -- a or Right b. -- -- The Either type is sometimes used to represent a value which is -- either correct or an error; by convention, the Left constructor -- is used to hold an error value and the Right constructor is -- used to hold a correct value (mnemonic: "right" also means "correct"). data Either a b :: * -> * -> * Left :: a -> Either a b Right :: b -> Either a b either :: (a -> c) -> (b -> c) -> Either a b -> c until :: (a -> Bool) -> (a -> a) -> a -> a ($!) :: (a -> b) -> a -> b -- | Evaluates its first argument to head normal form, and then returns its -- second argument as the result. seq :: a -> b -> b const :: a -> b -> a id :: a -> a (.) :: (t1 -> t) -> (t2 -> t1) -> t2 -> t ($) :: (t1 -> t) -> t1 -> t flip :: (t1 -> t2 -> t) -> t2 -> t1 -> t curry :: ((a, b) -> c) -> a -> b -> c uncurry :: (a -> b -> c) -> (a, b) -> c snd :: (t, t1) -> t1 fst :: (t, t1) -> t div :: Int -> Int -> Int mod :: Int -> Int -> Int divMod :: Int -> Int -> (Int, Int) min :: Num a => a -> a -> a max :: Num a => a -> a -> a recip :: Double -> Double -- | Implemented in Fay. negate :: Num a => a -> a -- | Implemented in Fay. abs :: (Num a, Ord a) => a -> a -- | Implemented in Fay. signum :: (Num a, Ord a) => a -> a -- | Uses Math.PI. pi :: Double -- | Uses Math.exp. exp :: Double -> Double -- | Uses Math.sqrt. sqrt :: Double -> Double -- | Uses Math.log. log :: Double -> Double -- | Uses Math.pow. (**) :: Double -> Double -> Double -- | Uses Math.pow. (^^) :: Double -> Int -> Double -- | Uses Math.pow. unsafePow :: (Num a, Num b) => a -> b -> a -- | Implemented in Fay, it's not fast. (^) :: Num a => a -> Int -> a -- | Implemented in Fay, not fast. logBase :: Double -> Double -> Double -- | Uses Math.sin. sin :: Double -> Double -- | Uses Math.tan. tan :: Double -> Double -- | Uses Math.cos. cos :: Double -> Double -- | Uses Math.asin. asin :: Double -> Double -- | Uses Math.atan. atan :: Double -> Double -- | Uses Math.acos. acos :: Double -> Double -- | Implemented in Fay, not fast. sinh :: Double -> Double -- | Implemented in Fay, not fast. tanh :: Double -> Double -- | Implemented in Fay, not fast. cosh :: Double -> Double -- | Implemented in Fay, not fast. asinh :: Double -> Double -- | Implemented in Fay, not fast. atanh :: Double -> Double -- | Implemented in Fay, not fast. acosh :: Double -> Double -- | Implemented in Fay, not fast. properFraction :: Double -> (Int, Double) -- | Implemented in Fay, not fast. truncate :: Double -> Int -- | Uses Math.round. round :: Double -> Int -- | Uses Math.ceil. ceiling :: Double -> Int -- | Uses Math.floor. floor :: Double -> Int -- | Flip (-). subtract :: Num a => a -> a -> a -- | Implemented in Fay, not fast. even :: Int -> Bool -- | not (even x) odd :: Int -> Bool -- | Implemented in Fay, not fast. gcd :: Int -> Int -> Int -- | Uses quot'. quot :: Int -> Int -> Int -- | Uses ~~(a/b). quot' :: Int -> Int -> Int -- | (quot x y, rem x y) quotRem :: Int -> Int -> (Int, Int) -- | Uses rem'. rem :: Int -> Int -> Int -- | Uses %%. rem' :: Int -> Int -> Int lcm :: Int -> Int -> Int find :: (a -> Bool) -> [a] -> Maybe a filter :: (a -> Bool) -> [a] -> [a] null :: [t] -> Bool map :: (a -> b) -> [a] -> [b] nub :: Eq a => [a] -> [a] nub' :: Eq a => [a] -> [a] -> [a] elem :: Eq a => a -> [a] -> Bool notElem :: Eq a => a -> [a] -> Bool sort :: Ord a => [a] -> [a] sortBy :: (t -> t -> Ordering) -> [t] -> [t] insertBy :: (a -> a -> Ordering) -> a -> [a] -> [a] -- | Append two lists. conc :: [a] -> [a] -> [a] concat :: [[a]] -> [a] concatMap :: (a -> [b]) -> [a] -> [b] foldr :: (t -> t1 -> t1) -> t1 -> [t] -> t1 foldr1 :: (a -> a -> a) -> [a] -> a foldl :: (t1 -> t -> t1) -> t1 -> [t] -> t1 foldl1 :: (a -> a -> a) -> [a] -> a (++) :: [a] -> [a] -> [a] (!!) :: [a] -> Int -> a head :: [a] -> a tail :: [a] -> [a] init :: [a] -> [a] last :: [a] -> a iterate :: (a -> a) -> a -> [a] repeat :: a -> [a] replicate :: Int -> a -> [a] cycle :: [a] -> [a] take :: Int -> [a] -> [a] drop :: Int -> [a] -> [a] splitAt :: Int -> [a] -> ([a], [a]) takeWhile :: (a -> Bool) -> [a] -> [a] dropWhile :: (a -> Bool) -> [a] -> [a] span :: (a -> Bool) -> [a] -> ([a], [a]) break :: (a -> Bool) -> [a] -> ([a], [a]) zipWith :: (a -> b -> c) -> [a] -> [b] -> [c] zipWith3 :: (a -> b -> c -> d) -> [a] -> [b] -> [c] -> [d] zip :: [a] -> [b] -> [(a, b)] zip3 :: [a] -> [b] -> [c] -> [(a, b, c)] unzip :: [(a, b)] -> ([a], [b]) unzip3 :: [(a, b, c)] -> ([a], [b], [c]) lines :: String -> [String] unlines :: [String] -> String words :: String -> [String] unwords :: [String] -> String and :: [Bool] -> Bool or :: [Bool] -> Bool any :: (a -> Bool) -> [a] -> Bool all :: (a -> Bool) -> [a] -> Bool intersperse :: a -> [a] -> [a] prependToAll :: a -> [a] -> [a] intercalate :: [a] -> [[a]] -> [a] maximum :: Num a => [a] -> a minimum :: Num a => [a] -> a product :: Num a => [a] -> a sum :: Num a => [a] -> a scanl :: (a -> b -> a) -> a -> [b] -> [a] scanl1 :: (a -> a -> a) -> [a] -> [a] scanr :: (a -> b -> b) -> b -> [a] -> [b] scanr1 :: (a -> a -> a) -> [a] -> [a] lookup :: Eq a1 => a1 -> [(a1, a)] -> Maybe a length :: [a] -> Int length' :: Int -> [a] -> Int reverse :: [a] -> [a] print :: Automatic a -> Fay () putStrLn :: String -> Fay () -- | Default definition for using RebindableSyntax. ifThenElse :: Bool -> t -> t -> t -- | The JavaScript FFI interfacing monad. data Fay a :: * -> * instance Integral Int instance Fractional Double instance Enum Int instance Ord Integer instance Ord Int instance Ord Double instance Ord Char instance Num Double instance Num Int module Data.Char chr :: Int -> Char ord :: Char -> Int isAscii :: Char -> Bool isLatin1 :: Char -> Bool toUpper :: Char -> Char toLower :: Char -> Char isAsciiLower :: Char -> Bool isAsciiUpper :: Char -> Bool isDigit :: Char -> Bool isOctDigit :: Char -> Bool isHexDigit :: Char -> Bool isSpace :: Char -> Bool module FFI module Debug.Trace trace :: String -> Ptr a -> Ptr a traceShow :: Automatic a -> Ptr b -> Ptr b module Data.Ratio data Rational Ratio :: Int -> Int -> Rational (%) :: Int -> Int -> Rational numerator :: Rational -> Int denominator :: Rational -> Int instance Typeable Rational instance Data Rational instance Show Rational