Typeclass constraint should pick the OverloadedString type.
{-# LANGUAGE OverloadedStrings #-}
import Data.Text as T
class NoDefault a where noDefault :: a -> Text
instance NoDefault T.Text where noDefault = id
main = print (noDefault "Hello!")
default.hs:7:15:
Ambiguous type variable `a0' in the constraints:
(NoDefault a0) arising from a use of `noDefault'
at default.hs:7:15-23
(Data.String.IsString a0) arising from the literal `"Hello!"'
at default.hs:7:25-32
Probable fix: add a type signature that fixes these type variable(s)
In the first argument of `print', namely `(noDefault "Hello!")'
In the expression: print (noDefault "Hello!")
In an equation for `main': main = print (noDefault "Hello!")
Trac metadata
| Trac field | Value |
|---|---|
| Version | 7.4.1 |
| Type | Bug |
| TypeOfFailure | OtherFailure |
| Priority | normal |
| Resolution | Unresolved |
| Component | Compiler |
| Test case | |
| Differential revisions | |
| BlockedBy | |
| Related | |
| Blocking | |
| CC | |
| Operating system | |
| Architecture |