data-default-generics alternatives and similar packages
Based on the "Data" category.
Alternatively, view data-default-generics alternatives based on common mentions on social networks and blogs.
-
lens
Lenses, Folds, and Traversals - Join us on web.libera.chat #haskell-lens -
semantic-source
Parsing, analyzing, and comparing source code across many languages -
hnix
A Haskell re-implementation of the Nix expression language -
code-builder
Packages for defining APIs, running them, generating client code and documentation. -
text
Haskell library for space- and time-efficient operations over Unicode text. -
cassava
A CSV parsing and encoding library optimized for ease of use and high performance -
unordered-containers
Efficient hashing-based container types -
compendium-client
Mu (μ) is a purely functional framework for building micro services. -
massiv
Efficient Haskell Arrays featuring Parallel computation -
holmes
A reference library for constraint-solving with propagators and CDCL. -
hashable
A class for types that can be converted to a hash value -
binary
Efficient, pure binary serialisation using ByteStrings in Haskell. -
resource-pool
A high-performance striped resource pooling implementation for Haskell -
primitive
This package provides various primitive memory-related operations. -
network-msgpack-rpc
A MessagePack-RPC Implementation -
hashtables
Mutable hash tables for Haskell, in the ST monad -
json-autotype
Automatic Haskell type inference from JSON input -
discrimination
Fast linear time sorting and discrimination for a large class of data types -
certificate
Certificate and Key Reader/Writer in haskell -
IORefCAS
A collection of different packages for CAS based data structures. -
reflection
Reifies arbitrary Haskell terms into types that can be reflected back into terms -
dependent-sum
Dependent sums and supporting typeclasses for comparing and displaying them -
audiovisual
Extensible records, variants, structs, effects, tangles -
dependent-map
Dependently-typed finite maps (partial dependent products) -
text-icu
This package provides the Haskell Data.Text.ICU library, for performing complex manipulation of Unicode text. -
orgmode-parse
Attoparsec parser combinators for parsing org-mode structured text! -
streaming
An optimized general monad transformer for streaming applications, with a simple prelude of functions -
protobuf
An implementation of Google's Protocol Buffers in Haskell. -
avro
Haskell Avro Encoding and Decoding Native Support (no RPC) -
safecopy
An extension to Data.Serialize with built-in version control -
bifunctors
Haskell 98 bifunctors, bifoldables and bitraversables -
typerep-map
⚡️Efficient implementation of Map with types as keys -
uuid-types
A Haskell library for creating, printing and parsing UUIDs -
scientific
Arbitrary-precision floating-point numbers represented using scientific notation -
uuid
A Haskell library for creating, printing and parsing UUIDs
Clean code begins in your IDE with SonarLint
Do you think we are missing an alternative of data-default-generics or a related project?
README
data-default-generics
A class for types with a default value.
This is a fork of the package originally developed by Lukas Mai, data-default, with the following additions:
- Regrouped everything in a single module
- Added several instances, namely Either, Text, ByteString, etc
- Added Generics support by Jonathan Fischoff, with some additional support for recursive datatypes by me, with the precious help of José Pedro Magalhães
It should be usable as a drop-in replacement.
Usage
Supose you've got a structure:
data TestRec = TestRec
{ bool :: Bool
, txt :: T.Text
, bs :: BSL.ByteString
, lst :: [CInt]
, ut :: UTCTime
} deriving (Eq,Show)
And you want to quickly define a default value for it, in a way that does not require code changes if the structure later gets altered. Modify the previous to:
{-# LANGUAGE DeriveGeneric #-}
(...)
import Data.Default.Generics
import GHC.Generics
(...)
data TestRec = TestRec
{ bool :: Bool
, txt :: T.Text
, bs :: BSL.ByteString
, lst :: [CInt]
, ut :: UTCTime
} deriving (Eq,Show, Generic)
instance Default TestRec
And then you can use the default value for this structure as def
, as long as you import Data.Default.Generics
.
Bugs
Issues and pull requests are most welcome. Any additional instance for data types from the Haskell Platform will be considered.