Haskell phantom-type tags, so functions don't take dummy arguments just to pick a type
open sourceBSD-3-Clausefree
tagged is a small Haskell library of values that carry an extra phantom type tag. Its Data.Tagged module lets a function return a value labelled with the type it belongs to, in plain Haskell 98, instead of taking an unused dummy argument only to choose the type. It's by Edward Kmett and tested on GHC 8.0 through 9.14.
Problems it solves
- stop passing undefined as a dummy argument just to pick a type in Haskell
- attach a type-level label to a value in Haskell
- write a Haskell function that returns a value for a type without a proxy argument
Features
- Tagged newtype for values labelled with a phantom type
- Haskell 98, with no language extensions needed
- Tested on GHC 8.0 to 9.14
