Popularity
5.7
Declining
Activity
0.0
Stable
14
2
1

Monthly Downloads: 20
Programming language: Haskell
License: BSD 3-clause "New" or "Revised" License
Tags: Data    
Latest version: v1.2.0.0

newtype-zoo alternatives and similar packages

Based on the "Data" category.
Alternatively, view newtype-zoo alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of newtype-zoo or a related project?

Add another 'Data' Package

README

General Purpose Newtype Wrappers

A zoo of newtype wrappers.

In everyday Haskell programming newtype wrappers occur again and again, to convey some extra meaning for the maintainer of the code, and to prevent mixing up parameters to functions with the same type.

For example:

applyConfiguration :: MyConfig -> MyConfig -> IO MyConfig

What the user actually wanted to express was:

applyConfiguration :: Wanted MyConfig -> Current MyConfig -> IO (Active MyConfig)

The newtype wrappers in this library are all exported by the NewtypeZoo module, or can be imported individually.

This simple library contains a variety of simple newtype wrappers:

They live in the sub directory NewtypeZoo, e.g. NewtypeZoo.Active.

This library offers shorter code for the special cases. The tagged library is more general, but requires more code.

The reason why I prefer this library in some cases, is shorter type signatures.

One can even combine tagged with newtype-zoo (I think I will add this to the README):


import Data.Tagged
import NewtypeZoo.Current
import NewtypeZoo.Wanted

applyConfigurationTagged
  :: Tagged Wanted MyConfig
  -> Tagged Current MyConfig
  -> IO (Tagged Current MyConfig)