Popularity
7.1
Declining
Activity
0.0
Stable
27
5
1
Monthly Downloads: 0
Programming language: Haskell
License: MIT License
Latest version: v0.1.4
compound-types alternatives and similar packages
Based on the "Data" category.
Alternatively, view compound-types 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 -
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. -
holmes
A reference library for constraint-solving with propagators and CDCL. -
resource-pool
A high-performance striped resource pooling implementation for Haskell -
binary
Efficient, pure binary serialisation using ByteStrings in Haskell. -
primitive
This package provides various primitive memory-related operations. -
json-autotype
Automatic Haskell type inference from JSON input -
audiovisual
Extensible records, variants, structs, effects, tangles -
dependent-map
Dependently-typed finite maps (partial dependent products) -
discrimination
Fast linear time sorting and discrimination for a large class of data types -
dependent-sum
Dependent sums and supporting typeclasses for comparing and displaying them -
IORefCAS
A collection of different packages for CAS based data structures. -
safecopy
An extension to Data.Serialize with built-in version control -
orgmode-parse
Attoparsec parser combinators for parsing org-mode structured text! -
reflection
Reifies arbitrary Haskell terms into types that can be reflected back into terms -
streaming
An optimized general monad transformer for streaming applications, with a simple prelude of functions -
scientific
Arbitrary-precision floating-point numbers represented using scientific notation -
bifunctors
Haskell 98 bifunctors, bifoldables and bitraversables -
protobuf
An implementation of Google's Protocol Buffers in Haskell. -
uuid-types
A Haskell library for creating, printing and parsing UUIDs -
text-icu
This package provides the Haskell Data.Text.ICU library, for performing complex manipulation of Unicode text.
Learn any GitHub repo in 59 seconds
Onboard AI learns any GitHub repo in minutes and lets you chat with it to locate functionality, understand different parts, and generate new code. Use it for free at www.getonboard.dev.
Promo
getonboard.dev
Do you think we are missing an alternative of compound-types or a related project?
README
Intro
This library provides first-class multi-arity product- and sum-types and neat type-level utilities for their composition. The solution is quite simple and doesn’t require the advanced proficiency in the language to be applied in practice.
Here's an example of what you can do with it:
-- |
-- This function exhibits the benefit of the first-class sum-type
-- being usable as a function parameter.
--
-- It also shows, how we can pattern-match it.
intCharBoolSumToString :: (Int + Char + Bool) -> String
intCharBoolSumToString =
\case
Sum3_1 int -> "Int: " <> show int
Sum3_2 char -> "Char: " <> show char
Sum3_3 bool -> "Bool: " <> show bool
-- |
-- Following is an example of a more complicated composition,
-- which is the same as the following type:
--
-- > Sum3 Int (Product2 Char (Sum2 Bool String)) Char
--
-- Just as in the math, the product operator exhibits a higher priority.
type SumAndProductMixture =
Int + Char * (Bool + String) + Char
-- |
-- Where there is a multiplication and addition,
-- there naturally must be a division and subtraction!
--
-- Following is an example of how we can extract parts of a composite type.
-- Here the type becomes the same as the following:
--
-- > Bool + String
type BoolOrString =
(SumAndProductMixture - Int - Char) / Char
Compatibility
The library supports GHC starting from version 8.6.1 and requires you to enable the NoStarIsType
extension.