Re: Is there a way to make this code compose generic ?

Li-yao Xia <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <[email protected]>
> Do you know if there is some performance issue to use a new class for this ?
>
> How can I be sure that all the method are statically resolve at the compile time ?

In principle there shouldn't be any impact on performance. Type classes are resolved at compile time, and you only use the generic implementations at known types. All of the relevant dictionaries are known at compile-time, so with enough inlining and simplification the generic constructors and other indirections should be eliminated.
In practice, inlining is still very heuristic, so you have to look at the generated code and maybe add INLINEABLE annotations and tweak other things to make sure it happens. The inspection-testing library (https://hackage.haskell.org/package/inspection-testing) enables automated tests that make sure that the code optimized by the compiler doesn't contain certain constructs that indicate missed inlining opportunities.

Cheers,
Li-yao

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.