Re: Is there a way to make this code compose generic ?
PICCA Frederic-Emmanuel <[email protected]>
| Newsgroups | gmane.comp.lang.haskell.cafe |
|---|---|
| Message-ID | <124966376.104286777.1745568429301.JavaMail.zimbra@synchrotron-soleil.fr> |
----- Le 24 Avr 25, à 22:41, Li-yao Xia [email protected] a écrit : > You can delegate to another class that has a default implementation > > instance GDSAK1 a => GDataSourceAcq (K1 i a) where > g'ds'Shape (K1 a) = g'ds'Shape'K1 a > > class GDSAK1 a where > g'ds'Shape'K1 :: ... > g'ds'Shape'K1 _ = pure shape1 > > instance GDSAK1 (a DSAcq) where > g'ds'Shape'K1 = ... > > instance GDSAK1 Degree > instance GDSAK1 Double > ... > > You can also use an overlappable instance to not list all the instances, > but the downside is you don't get an error if you forget to override it. I prefer the first solution. I use haskell for the compiler errors :) 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 ? I do not know If I am clear. thanks Fred _______________________________________________ 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.