Treat strings like any other pattern literal

This commit is contained in:
Evan Czaplicki 2013-10-02 16:55:46 -07:00
parent dce5e3eade
commit 958fb1c896

View file

@ -23,11 +23,7 @@ basic = choice
"True" -> PLiteral (Boolean True)
"False" -> PLiteral (Boolean False)
c : _ -> if isUpper c then PData v [] else PVar v
, do lit <- literal
return $ case lit of
Str s -> foldr combine (PData "[]" []) s
where combine h t = PData "::" [PLiteral (Chr h),t]
_ -> PLiteral lit
, PLiteral <$> literal
]
asPattern :: Pattern -> IParser Pattern