summaryrefslogtreecommitdiff
path: root/compiler/deSugar/MatchLit.lhs
diff options
context:
space:
mode:
authorIan Lynagh <igloo@earth.li>2008-04-23 16:11:15 +0000
committerIan Lynagh <igloo@earth.li>2008-04-23 16:11:15 +0000
commit6821c8a47c0fc61a2d989d368f926cc0ded776e9 (patch)
tree20a9176e28577a0909cb7fb63320bb34616455a8 /compiler/deSugar/MatchLit.lhs
parent1cd9b26ddbc76e67f680b4f58e3452c6708503f1 (diff)
downloadhaskell-6821c8a47c0fc61a2d989d368f926cc0ded776e9.tar.gz
Add 123## literals for Word#
Diffstat (limited to 'compiler/deSugar/MatchLit.lhs')
-rw-r--r--compiler/deSugar/MatchLit.lhs5
1 files changed, 4 insertions, 1 deletions
diff --git a/compiler/deSugar/MatchLit.lhs b/compiler/deSugar/MatchLit.lhs
index 24dff8d5bb..31d3c28b2e 100644
--- a/compiler/deSugar/MatchLit.lhs
+++ b/compiler/deSugar/MatchLit.lhs
@@ -69,6 +69,7 @@ dsLit :: HsLit -> DsM CoreExpr
dsLit (HsStringPrim s) = return (mkLit (MachStr s))
dsLit (HsCharPrim c) = return (mkLit (MachChar c))
dsLit (HsIntPrim i) = return (mkLit (MachInt i))
+dsLit (HsWordPrim w) = return (mkLit (MachWord w))
dsLit (HsFloatPrim f) = return (mkLit (MachFloat f))
dsLit (HsDoublePrim d) = return (mkLit (MachDouble d))
@@ -103,6 +104,7 @@ hsLitKey :: HsLit -> Literal
-- It only works for primitive types and strings;
-- others have been removed by tidy
hsLitKey (HsIntPrim i) = mkMachInt i
+hsLitKey (HsWordPrim w) = mkMachWord w
hsLitKey (HsCharPrim c) = MachChar c
hsLitKey (HsStringPrim s) = MachStr s
hsLitKey (HsFloatPrim f) = MachFloat f
@@ -128,7 +130,7 @@ hsOverLitKey (HsIsString s _ _) False = MachStr s
\begin{code}
tidyLitPat :: HsLit -> Pat Id
-- Result has only the following HsLits:
--- HsIntPrim, HsCharPrim, HsFloatPrim
+-- HsIntPrim, HsWordPrim, HsCharPrim, HsFloatPrim
-- HsDoublePrim, HsStringPrim, HsString
-- * HsInteger, HsRat, HsInt can't show up in LitPats
-- * We get rid of HsChar right here
@@ -145,6 +147,7 @@ tidyLitPat lit = LitPat lit
tidyNPat :: HsOverLit Id -> Maybe (SyntaxExpr Id) -> SyntaxExpr Id -> Pat Id
tidyNPat over_lit mb_neg eq
| isIntTy (overLitType over_lit) = mk_con_pat intDataCon (HsIntPrim int_val)
+ | isWordTy (overLitType over_lit) = mk_con_pat wordDataCon (HsWordPrim int_val)
| isFloatTy (overLitType over_lit) = mk_con_pat floatDataCon (HsFloatPrim rat_val)
| isDoubleTy (overLitType over_lit) = mk_con_pat doubleDataCon (HsDoublePrim rat_val)
-- | isStringTy lit_ty = mk_con_pat stringDataCon (HsStringPrim str_val)