2

I have the following haskell file:

import Text.ParserCombinators.Parsec
import Text.ParserCombinators.Parsec.Number

parseF = floating

Loading up in ghci I get the following:

*Main> :t floating
floating :: Floating f => CharParser st f
*Main> :t parseFloating
parseFloating :: CharParser st Double

How can it be that the types are different?

And how can I stop this from happening?

  • Monomorphism restriction? – MathematicalOrchid Apr 14 '15 at 16:07
  • Have you tried turning off the [dreaded monomorphism restriction](https://wiki.haskell.org/Monomorphism_restriction) with `{-# LANGUAGE NoMonomorphismRestriction #-}` at the top of your file? – bheklilr Apr 14 '15 at 16:07
  • 3
    @MathematicalOrchid Do we have a "canonical" answer for the DMR? We should close this as a duplicate to help funnel these questions to a single answer since this is such a hard problem to google when you don't know about the DMR already. – bheklilr Apr 14 '15 at 16:18
  • @bheklilr It's a VFAQ, but I'm not sure about an actual canonical answer... – MathematicalOrchid Apr 14 '15 at 16:32
  • 3
    @bheklilr, MathematicalOrchid Maybe this should be the canonical answer: http://stackoverflow.com/a/7055932/1651941 – Sibi Apr 14 '15 at 16:34
  • @Sibi That one looks good to me. MathematicalOrchid, RichardFergie, do you agree that it looks acceptable? If everyone agrees we can mark this question as a duplicate. – bheklilr Apr 14 '15 at 16:36
  • 1
    @Sibi It looks like your suggestion is popular, with at least 4 people agreeing with it (including yourself). I'll go ahead and mark the duplicate, if someone disagrees then they can comment here. – bheklilr Apr 14 '15 at 17:16
  • 1
    @bheklilr The problem with finding a canonical answer may also lie on being difficult to find a canonical question. From a quick search, no one ever asked exactly "What is the DMR?". That being said, the answer suggested by Sibi looks as a great "canonical" answer to DMR questions. – chi Apr 14 '15 at 17:16
  • 2
    @chi That is precisely why I attempted to have a short discussion about what would be a good answer to use. The problem is that many questions that seem unrelated all have the same answer, and I think it would be best to start funneling all of those questions into a single good answer. pigworker's answer on the linked post is thorough enough, old enough, and liked enough to be a good candidate. I don't think we can necessarily stop people from asking the questions, but if we mark them all as a duplicate of the same question then it'll be better than the current state of affairs. – bheklilr Apr 14 '15 at 17:20

0 Answers0