Suppose the Haskell function application (the "space" operator) was in the class, instead of baking the language. I guess it will look like
class Apply f where ($) :: far -> a -> r instance Apply (->) where ($) = builtinFnApply
And fa will desugar to f $ a . The idea is that this will allow you to define other types that act as functions, i.e.
instance Apply LinearMap where ($) = matrixVectorMult
etc.
Does this make type inference unsolvable? My instinct says that it is, but my understanding of type inference dwells on a simple Hindley-Milner. As a continuation, if it is not decidable, can it be decidable by prohibiting certain pathological cases?
source share