summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
77ef739)
Fixed some Haddock links.
-- > plus n x = execState (sequence $ replicate n tick) x
--
-- An example from /The Craft of Functional Programming/, Simon
-- > plus n x = execState (sequence $ replicate n tick) x
--
-- An example from /The Craft of Functional Programming/, Simon
--- Thompson (<http://www.cs.ukc.ac.uk/people/staff/sjt/>),
--- Addison-wesley 1999: \"Given an arbitrary tree, transform it to a
+-- Thompson (<http://www.cs.kent.ac.uk/people/staff/sjt/>),
+-- Addison-Wesley 1999: \"Given an arbitrary tree, transform it to a
-- tree of integers in which the original elements are replaced by
-- natural numbers, starting from 0. The same element has to be
-- replaced by the same number at every occurrence, and when we meet
-- tree of integers in which the original elements are replaced by
-- natural numbers, starting from 0. The same element has to be
-- replaced by the same number at every occurrence, and when we meet
-- Portability : non-portable
--
-- Generic programming in Haskell;
-- Portability : non-portable
--
-- Generic programming in Haskell;
--- see <http://www.cs.vu.nl/boilerplate>.
+-- see <http://www.cs.vu.nl/boilerplate/>.
--
-----------------------------------------------------------------------------
--
-----------------------------------------------------------------------------
type GenericT = forall a. Data a => a -> a
type GenericT = forall a. Data a => a -> a
--- | Generic queries of type "r",
+-- | Generic queries of type \"r\",
-- i.e., take any \"a\" and return an \"r\"
--
type GenericQ r = forall a. Data a => a -> r
-- i.e., take any \"a\" and return an \"r\"
--
type GenericQ r = forall a. Data a => a -> r
-- | Make a generic monadic transformation for MonadPlus;
-- | Make a generic monadic transformation for MonadPlus;
--- use "const mzero" (i.e., failure) instead of return as default.
+-- use \"const mzero\" (i.e., failure) instead of return as default.
--
mkF :: (Typeable a, Typeable b, Typeable (m a), Typeable (m b), MonadPlus m)
=> (b -> m b) -> a -> m a
--
mkF :: (Typeable a, Typeable b, Typeable (m a), Typeable (m b), MonadPlus m)
=> (b -> m b) -> a -> m a
gtypecount f = gcount (False `mkQ` (const True . f))
gtypecount f = gcount (False `mkQ` (const True . f))
--- | Generic show: an alternative to "deriving Show"
+-- | Generic show: an alternative to \"deriving Show\"
gshow :: Data a => a -> String
-- This is a prefix-show using surrounding "(" and ")",
gshow :: Data a => a -> String
-- This is a prefix-show using surrounding "(" and ")",
) `extQ` (show :: String -> String)
) `extQ` (show :: String -> String)
--- | Generic equality: an alternative to "deriving Eq"
+-- | Generic equality: an alternative to \"deriving Eq\"
geq :: Data a => a -> a -> Bool
{-
geq :: Data a => a -> a -> Bool
{-
--- | Generic read: an alternative to "deriving Read"
+-- | Generic read: an alternative to \"deriving Read\"
gread :: GenericB Maybe String
{-
gread :: GenericB Maybe String
{-
-- | The 'group' function takes a list and returns a list of lists such
-- that the concatenation of the result is equal to the argument. Moreover,
-- each sublist in the result contains only equal elements. For example,
-- | The 'group' function takes a list and returns a list of lists such
-- that the concatenation of the result is equal to the argument. Moreover,
-- each sublist in the result contains only equal elements. For example,
--- when applied to the string `Mississippi', the result is @["M","i","ss","i","ss","i","pp","i"]@.
+-- when applied to the string \"Mississippi\", the result is @[\"M\",\"i\",\"ss\",\"i\",\"ss\",\"i\",\"pp\",\"i\"]@.
group :: (Eq a) => [a] -> [[a]]
group = groupBy (==)
group :: (Eq a) => [a] -> [[a]]
group = groupBy (==)