🤳 ignore the differences between `a` and `Identity a`
MIT License
| Hackage
The ego is only an illusion, but a very influential one. Letting the ego-illusion become your identity can prevent you from knowing your true self. Ego, the false idea of believing that you are what you have or what you do, is a backwards way of assessing and living life.
Wayne Dyer
I think higher-kinded data is a pretty cool guy. eh reuses datatypes and doesn't afraid of anything. But working with HKD isn't everything it's cracked up to be -- it makes deriving instances hard, requires janky type families, and in general doesn't fill you with any sense of joy.
Enter same-same
: a compiler plugin that provides proofs of a ~ Identity a
and makes working with HKD a little less shit. Armed with this proof, we're able
to get rid of the HKD type family, and thus regain our derived instances.
This plugin is a teensy little bit completely unsound and when used for
evil, is capable of producing forall a b. a ~ b
proofs. Fortunately, you need
to be actively trying to accomplish such a feat, and so you're probably going to
be a-ok.
Modules that haven't loaded the plugin are not affected by this "feature."
{-# OPTIONS_GHC -fplugin=Data.Functor.Identity.Plugin #-}
module Test where
import Data.Functor.Identity
data X f = X
{ foo :: f Int
}
getFoo :: X Identity -> Int
getFoo = foo
Please reports bugs and missing features at the GitHub bugtracker. This is also where you can find the source code.
same-same
was written by Sandy Maguire and is licensed under a
permissive MIT license.