on 6f75310 help sign in
20 lines 521 B history raw
1module SourceSyntax.Literal where
3import SourceSyntax.PrettyPrint
4import qualified Text.PrettyPrint as PP
6data Literal = IntNum Int
7 | FloatNum Double
8 | Chr Char
9 | Str String
10 | Boolean Bool
11 deriving (Eq, Ord, Show)
13instance Pretty Literal where
14 pretty literal =
15 case literal of
16 IntNum n -> PP.int n
17 FloatNum n -> PP.double n
18 Chr c -> PP.quotes (PP.char c)
19 Str s -> PP.text (show s)
20 Boolean bool -> PP.text (show bool)