Skip to content

Type synonym lost with GADTs

Consider the following:

type Joules = Double
type Grams = Double

data Unit a where
  Energy :: Unit Joules
  Mass :: Unit Grams

test :: Unit a -> a
test Energy = _

GHC reports the hole as _ :: Double, but I expected the synonym to remain intact, i.e., that the hole would be _ :: Joules.

To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information