on master help sign in
Treat strings like any other pattern literal
958fb1cEvan Czaplicki
compiler/Parse/Pattern.hs+1−5
@@ -23,11 +23,7 @@ basic = choice
23 "True" -> PLiteral (Boolean True)
23 "True" -> PLiteral (Boolean True)
24 "False" -> PLiteral (Boolean False)
24 "False" -> PLiteral (Boolean False)
25 c : _ -> if isUpper c then PData v [] else PVar v
25 c : _ -> if isUpper c then PData v [] else PVar v
26− , do lit <- literal
26+ , PLiteral <$> literal
27− return $ case lit of
28− Str s -> foldr combine (PData "[]" []) s
29− where combine h t = PData "::" [PLiteral (Chr h),t]
30− _ -> PLiteral lit
31 ]
27 ]
32
28
33asPattern :: Pattern -> IParser Pattern
29asPattern :: Pattern -> IParser Pattern