-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | Strict data types and String IO. -- -- This package provides strict versions of some standard Haskell data -- types (pairs, Maybe and Either). It also contains strict IO -- operations. @package strict @version 0.3.2 -- | The standard IO input functions using strict IO. module System.IO.Strict -- | Computation hGetContents hdl returns the list of -- characters corresponding to the unread portion of the channel or file -- managed by hdl, which is immediate closed. -- -- Items are read strictly from the input Handle. -- -- This operation may fail with: -- -- hGetContents :: Handle -> IO String -- | The getContents operation returns all user input as a single -- string, which is read stirctly (same as hGetContents -- stdin). getContents :: IO String -- | The readFile function reads a file and returns the contents of -- the file as a string. The file is read strictly, as with -- getContents. readFile :: FilePath -> IO String -- | The interact function takes a function of type -- String->String as its argument. The entire input from the -- standard input device is passed to this function as its argument, and -- the resulting string is output on the standard output device. interact :: (String -> String) -> IO () -- | Strict Either. -- -- Same as the standard Haskell Either, but Left _|_ = Right -- _|_ = _|_ module Data.Strict.Either -- | The strict choice type. data Either a b Left :: !a -> Either a b Right :: !b -> Either a b -- | Case analysis: if the value is Left a, apply the first -- function to a; if it is Right b, apply the -- second function to b. either :: (a -> c) -> (b -> c) -> Either a b -> c -- | Yields True iff the argument is of the form Left _. isLeft :: Either a b -> Bool -- | Yields True iff the argument is of the form Right _. isRight :: Either a b -> Bool -- | Extracts the element out of a Left and throws an error if the -- argument is a Right. fromLeft :: Either a b -> a -- | Extracts the element out of a Right and throws an error if the -- argument is a Left. fromRight :: Either a b -> b instance (Eq a, Eq b) => Eq (Either a b) instance (Ord a, Ord b) => Ord (Either a b) instance (Read a, Read b) => Read (Either a b) instance (Show a, Show b) => Show (Either a b) instance Functor (Either a) -- | Strict Maybe. -- -- Same as the standard Haskell Maybe, but Just _|_ = -- _|_ -- -- Note that strict Maybe is not a monad since return _|_ -- >>= f = _|_ which is not necessarily the same as f -- _|_. module Data.Strict.Maybe -- | The type of strict optional values. data Maybe a Nothing :: Maybe a Just :: !a -> Maybe a -- | Yields True iff the argument is of the form Just _. isJust :: Maybe a -> Bool -- | Yields True iff the argument is Nothing. isNothing :: Maybe a -> Bool -- | Extracts the element out of a Just and throws an error if the -- argument is Nothing. fromJust :: Maybe a -> a -- | Given a default value and a Maybe, yield the default value if -- the Maybe argument is Nothing and extract the value out -- of the Just otherwise. fromMaybe :: a -> Maybe a -> a -- | Given a default value, a function and a Maybe value, yields the -- default value if the Maybe value is Nothing and applies -- the function to the value stored in the Just otherwise. maybe :: b -> (a -> b) -> Maybe a -> b instance Eq a => Eq (Maybe a) instance Ord a => Ord (Maybe a) instance Show a => Show (Maybe a) instance Read a => Read (Maybe a) instance Functor Maybe -- | Strict pairs. -- -- Same as regular Haskell pairs, but (x :*: _|_) = (_|_ :*: y) = -- _|_ module Data.Strict.Tuple -- | The type of strict pairs. data Pair a b (:!:) :: !a -> !b -> Pair a b type :!: = Pair -- | Extract the first component of a strict pair. fst :: Pair a b -> a -- | Extract the second component of a strict pair. snd :: Pair a b -> b -- | Curry a function on strict pairs. curry :: (Pair a b -> c) -> a -> b -> c -- | Convert a curried function to a function on strict pairs. uncurry :: (a -> b -> c) -> Pair a b -> c instance (Eq a, Eq b) => Eq (Pair a b) instance (Ord a, Ord b) => Ord (Pair a b) instance (Show a, Show b) => Show (Pair a b) instance (Read a, Read b) => Read (Pair a b) instance (Bounded a, Bounded b) => Bounded (Pair a b) instance (Ix a, Ix b) => Ix (Pair a b) -- | Strict versions of some standard Haskell types. module Data.Strict