1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
|
--------------------------------------------------------------------------------
-- |
-- Module : Text.Show.Value
-- Copyright : (c) Iavor S. Diatchki 2009
-- License : BSD3
--
-- Maintainer : iavor.diatchki@gmail.com
-- Stability : provisional
-- Portability : Haskell 98
--
-- Generic representation of Showable values.
--------------------------------------------------------------------------------
module Text.Show.Value ( Name, Value(..) ) where
-- | A name.
type Name = String
-- | Generic Haskell values.
-- 'NaN' and 'Infinity' are represented as constructors.
-- The 'String' in the literals is the text for the literals \"as is\".
data Value = Con Name [Value] -- ^ Data constructor
| Rec Name [ (Name,Value) ] -- ^ Record value
| Tuple [Value] -- ^ Tuple
| List [Value] -- ^ List
| Neg Value -- ^ Negated value
| Ratio Value Value -- ^ Rational
| Integer String -- ^ Non-negative integer
| Float String -- ^ Non-negative floating num.
| Char String -- ^ Character
| String String -- ^ String
deriving (Eq,Show)
|