Consider the following (not particularly useful) Haskell function
f :: forall a . Eq a => a -> a -> ()
f x y = if x == y then f [x, x] [y, y] else ()
My understanding is that this would be translated to something like
Consider the following (not particularly useful) Haskell function
f :: forall a . Eq a => a -> a -> ()
f x y = if x == y then f [x, x] [y, y] else ()
My understanding is that this would be translated to something like
-- Code taken from http://stackoverflow.com/questions/12735274/breaking-data-set-integrity-without-generalizednewtypederiving/12744568#12744568 | |
-- Discussion on haskell-cafe: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/100870 | |
-- http://www.haskell.org/pipermail/haskell-cafe/2012-October/103984.html | |
-- Modified to remove orphan instances by rwbarton | |
module A where | |
data U = X | Y deriving (Eq, Ord, Show) | |
data T u b c = T u b c deriving (Eq, Show) |
-- Code taken from http://stackoverflow.com/questions/12735274/breaking-data-set-integrity-without-generalizednewtypederiving/12744568#12744568 | |
-- Discussion on haskell-cafe: http://thread.gmane.org/gmane.comp.lang.haskell.cafe/100870 | |
-- http://www.haskell.org/pipermail/haskell-cafe/2012-October/103984.html | |
-- | |
-- See also: http://blog.ezyang.com/2014/07/type-classes-confluence-coherence-global-uniqueness/ | |
-- https://gist.github.com/rwbarton/dd8e51dce2a262d17a80 | |
module A where | |
data U = X | Y deriving (Eq, Show) |