#5255: String literals cause runtime crashes when OverloadedStrings is in effect
---------------------------------+------------------------------------------
Reporter: YitzGale | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.0.3
Keywords: | Testcase:
Blockedby: | Difficulty:
Os: Unknown/Multiple | Blocking:
Architecture: Unknown/Multiple | Failure: None/Unknown
---------------------------------+------------------------------------------
Comment(by cdsmith):
Replying to [comment:4 YitzGale]:
> True. That is a related but different problem. It is a problem with
> the design of the `Num` class. At least `(*)` is a function.
I'm not sure it's a different problem at all. In fact, it's very easy to
produce a Num instance such that numeric literals cause runtime errors as
well:
{{{
data Nat = Z | S Nat deriving (Show, Eq)
instance Num Nat where
fromInteger n | n < 0 = error "Negative Nat"
| n == 0 = Z
| otherwise = S (fromInteger (n-1))
}}}
This is directly analogous to the issue you mention with strings.
--
Ticket URL: <http://hackage.haskell.org/trac/ghc/ticket/5255#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs