diff options
author | lennart@augustsson.net <unknown> | 2006-12-21 21:01:47 +0000 |
---|---|---|
committer | lennart@augustsson.net <unknown> | 2006-12-21 21:01:47 +0000 |
commit | 90dc9026b091be5cca5da4c6cbd3713ecc493361 (patch) | |
tree | daa55695147d7dabe0358299275b49b9d00576a2 /compiler/deSugar/Check.lhs | |
parent | 6934648968eaff9873679365dfe50a0f281c2b6e (diff) | |
download | haskell-90dc9026b091be5cca5da4c6cbd3713ecc493361.tar.gz |
Add support for overloaded string literals.
The class is named IsString with the single method fromString.
Overloaded strings work the same way as overloaded numeric literals.
In expressions a string literals gets a fromString applied to it.
In a pattern there will be an equality comparison with the fromString:ed literal.
Use -foverloaded-strings to enable this extension.
Diffstat (limited to 'compiler/deSugar/Check.lhs')
-rw-r--r-- | compiler/deSugar/Check.lhs | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/compiler/deSugar/Check.lhs b/compiler/deSugar/Check.lhs index 15fcf39405..359035f705 100644 --- a/compiler/deSugar/Check.lhs +++ b/compiler/deSugar/Check.lhs @@ -424,6 +424,7 @@ get_lit :: Pat id -> Maybe HsLit get_lit (LitPat lit) = Just lit get_lit (NPat (HsIntegral i _) mb _ _) = Just (HsIntPrim (mb_neg mb i)) get_lit (NPat (HsFractional f _) mb _ _) = Just (HsFloatPrim (mb_neg mb f)) +get_lit (NPat (HsIsString s _) _ _ _) = Just (HsStringPrim s) get_lit other_pat = Nothing mb_neg :: Num a => Maybe b -> a -> a |