Are implicit parameters difficult to include in the GHC?

I am interested in objections to the implicit parameters discussed in the Functional Pearl: Implicit Configurations . Kiselev and Shan.

This is not the sound of inline code (β-reduction) in the presence of implicit parameters.

Really? I expect GHC to embed in the same scope as the passed implicit parameter, no?

I believe that I understand their objection that:

The behavior of the conditions may change if its signature is added, deleted or changed.

The GHC user documentation explains that programmers must comply with polymorphic recursion and monomorphism restriction . Is this somehow what they mean by a problem for investing?

I assume that this example of polymorphic recursion covers what they mean by “generalization by implicit parameters”? Anything else?

Is a class of ReifiesStorabletype Data.Reflection really a reasonable solution to these difficulties? Apparently, it deserializes the entire implicit data structure at every access, which sounds disastrous for performance. We could, for example, want our implicit information to be a Cayley table or table that occupies a ram concert and must have access for millions of algebraic operations.

Is it possible some better solution that uses implicit parameters, or another method that the compiler can easily optimize, behind the scenes, while still guaranteeing more through the type system, using state flows or something else?

+5
1

, GHC , , , , , inlining; len_acc1 len_acc2 , , .

, , , ; , , , . doSomethingWith :: (Reifies s a, Num a) => Proxy s -> a, , .

ReifiesStorable, ; , reify , . 1 . ReifiesStorable , Reifies, ReifiesStorable StablePtr, , . ( , ). , , , , "" 100 100000 , 10 .

( : .)

1 Haskell. , Haskell, ; , GHC Hugs, , . -fslow, , GHC . ( , , , .)

+7

All Articles