Skip to content

Instantly share code, notes, and snippets.

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

@rwbarton
rwbarton / A.hs
Last active February 2, 2017 09:32 — forked from 23Skidoo/A.hs
-- 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)
@23Skidoo
23Skidoo / A.hs
Last active October 11, 2015 11:48
Safe Haskell doesn't enforce global uniqueness of instances
-- 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)