weight )
where
+import System.Console.CmdArgs.Default ( Default(..) )
import Text.Parsec (
(<|>),
char,
-- >>> sum [w1, w2, w3]
-- Weight 4
--
-newtype Weight = Weight Int deriving (Eq, Num, Show)
+newtype Weight = Weight Int deriving (Eq, Num, Ord, Show)
-- | Pretty-print a 'Weight'. This just shows/prints the underlying 'Int'.
pretty_show (Weight w) = show w
+-- | Set a default value for the weight. We use the 'Default' class
+-- from the CmdArgs class so that 'Weight's can be easily parsed on
+-- the command-line.
+--
+-- ==== _Examples_
+--
+-- >>> def :: Weight
+-- Weight 1
+--
+instance Default Weight where def = 1
+
+
-- | Parse the weight multiplier off the end of an input 'Site'. This
-- expects there to be a \"multiplier\" character (an asterisk)
-- before the integral weight.