[Haskell-cafe] read "2" in a "void" context?

Erik Rantapaa erantapaa at gmail.com
Fri May 27 19:35:22 UTC 2016



On Friday, May 27, 2016 at 1:38:36 PM UTC-5, David Kraeutmann wrote:
>
> GHCi enables -XExtendedDefaultRules, which cause read "2" to default to 
> (). 
>

Ah - thank you very much! Indeed it is a consequence of the 
ExtendedDefaultRules option:

GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help
Prelude> :set -XNoExtendedDefaultRules
Prelude> read "2"

<interactive>:3:1:
    No instance for (Read a0) arising from a use of ‘it’


On 5/27/2016 8:28 PM, Erik Rantapaa wrote: 
> > Hi fellow Haskellers! 
> > 
> > If I bring up ghci and evaluate `read 2` I get the error "Prelude.read: 
> no 
> > parse" 
> > 
> > GHCi, version 7.10.2: http://www.haskell.org/ghc/  :? for help 
> > Prelude> read "2" 
> > *** Exception: Prelude.read: no parse 
> > 
> > Exactly how is this message coming about? I understand that `read` needs 
> a 
> > return type in order to determine which type class instance to run. So, 
> in 
> > this case, which type is `read` being asked to return? 
> > 
> > Thanks, 
> > Erik 
> > 
> > 
> > 
> > 
> > _______________________________________________ 
> > Haskell-Cafe mailing list 
> > Haskel... at haskell.org <javascript:> 
> > http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe 
> > 
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/haskell-cafe/attachments/20160527/8d309201/attachment.html>


More information about the Haskell-Cafe mailing list