[Haskell-cafe] Optional "Default" instances of classes in certain subcases (but too broad)

Juan Casanova juan.casanova at ed.ac.uk
Sun Oct 6 17:35:33 UTC 2019


> Does that accommodate the use cases you’re looking for?

It probably does, to be honest. I need to try it, but from your  
example I gather that the newtype is only defined so that the deriving  
can be used, but I do not ever need to explicitly use the newtype that  
I declared in order to be able to derive the functor instance. It is  
essentially what I said, except it uses the newtype as a "carrier" for  
the optional instance.

Thanks. If I find out any use case where it's not enough I'll come  
back here, but it does look like it's enough.

Juan.


-- 
The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.




More information about the Haskell-Cafe mailing list