0
  first_forward_pass =
    L.scanl' (L.foldl' fill_knapsack_without_parent_pointers)

* Ambiguous type variable `t0' arising from a use of L.foldl'
  prevents the constraint `(Foldable t0)' from being solved.

The compiler says that it wants me to specify the types to L.fold' which is annoying. I can't be bothered to specify the type for every little thing while I am writing stuff, so can I turn on some extension so it defers solving for the typeclass constraint until it actually needs it?

Edit: I see now that once I use it with a list it specializes the second argument to a [[(Int,Int)]] even without type annotations. I thought it would end up being a generic [t (Int, Int)].

Marko Grdinić
  • 3,798
  • 3
  • 18
  • 21
  • Yeah, this is it. Is there any downside to disabling the monomorphism restriction? – Marko Grdinić Jan 16 '17 at 15:35
  • 2
    There is not much downside to disabling it. But monomorphism restriction can sometimes be considered as your 'guideline' for doing polymorphism. But most likely you won't encounter trouble with disabling it unless you are careless. – WQYeo Jan 16 '17 at 15:44

0 Answers0