Transforming a function to point-free style changes its type

后端 未结 3 1161
独厮守ぢ
独厮守ぢ 2021-02-19 04:35

I\'m beginning Haskell... I tried to write the following trivial function in two different ways, letting Haskell decide the types, and the type system does something different i

3条回答
  •  孤城傲影
    2021-02-19 05:29

    Because the definition of g doesn't explicitly name its arguments, you run into the monomorphism restriction, preventing g from being polymorphic and (in this case) causing GHC to default to Integer.

提交回复
热议问题