[Haskell-cafe] Deriving Eq and Show instances for testing

Ruben Astudillo ruben.astud at gmail.com
Thu Mar 31 15:50:24 UTC 2016


On 31/03/16 12:43, Anakreontas wrote:
> I have datatypes for which I need an Eq and Show instance only for testing.
> I could derive those instances in the datatype declaration but I prefer not
> to add unnecessary functionality. With StandaloneDeriving extension I can
> derive the instances in the test module but this produces many warning
> about orphan instances. Is there a better approach or a way to stop reports
> about orphan instance warnings?
>
> Regards
>
>
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
>
You can put
     {-# OPTIONS_GHC -fno-warn-orphans #-}
At the top of such files to stop warnings, see also [1]

[1]: 
https://stackoverflow.com/questions/3079537/orphaned-instances-in-haskell

-- 
-- Ruben Astudillo


More information about the Haskell-Cafe mailing list