flat-maybe alternatives and similar packages
Based on the "Data" category.
Alternatively, view flat-maybe alternatives based on common mentions on social networks and blogs.
-
semantic-source
Parsing, analyzing, and comparing source code across many languages -
lens
Lenses, Folds, and Traversals - Join us on web.libera.chat #haskell-lens -
text
Haskell library for space- and time-efficient operations over Unicode text. -
code-builder
Packages for defining APIs, running them, generating client code and documentation. -
compendium-client
Mu (μ) is a purely functional framework for building micro services. -
unordered-containers
Efficient hashing-based container types -
cassava
A CSV parsing and encoding library optimized for ease of use and high performance -
holmes
A reference library for constraint-solving with propagators and CDCL. -
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. -
discrimination
Fast linear time sorting and discrimination for a large class of data types -
audiovisual
Extensible records, variants, structs, effects, tangles -
reflection
Reifies arbitrary Haskell terms into types that can be reflected back into terms -
IORefCAS
A collection of different packages for CAS based data structures. -
dependent-map
Dependently-typed finite maps (partial dependent products) -
dependent-sum
Dependent sums and supporting typeclasses for comparing and displaying them -
streaming
An optimized general monad transformer for streaming applications, with a simple prelude of functions -
orgmode-parse
Attoparsec parser combinators for parsing org-mode structured text! -
text-icu
This package provides the Haskell Data.Text.ICU library, for performing complex manipulation of Unicode text. -
safecopy
An extension to Data.Serialize with built-in version control -
scientific
Arbitrary-precision floating-point numbers represented using scientific notation -
uuid-types
A Haskell library for creating, printing and parsing UUIDs
Access the most powerful time series database as a service
Do you think we are missing an alternative of flat-maybe or a related project?
README
flat-maybe
In the Rust programming language, there is a nice optimization for the Option
(the analogue of Maybe
in Haskell) type: if the Option
holds a reference type, then the Option<A>
values are represented as a pointer that's either some null-like value or a pointer to the object itself. In contrast, Haskell's Maybe
always has at least two indirections:
ptr
|
|
Just | ptr
|
|
tag | data
This package implements the Rust scheme in an absolutely ungodly way. Basically, a Maybe a
is either a pointer to an a
object, or a pointer to a dummy "null" value that isn't exported from the library. The representation is newtype Maybe a = Maybe Any
. We check "constructors" with reallyUnsafePtrEquality#
. The result looks like this:
ptr
|
|
tag | data
One rather nasty thing about this solution is that our Just
isn't parametrically polymorphic: Just (Just Nothing)
immediately collapses to Nothing
for any number of intermediate Just
-s, but it works normally for any non-Maybe
type. A funny consequence is that we can implement the monadic join as unsafeCoerce
.
Nasty this might be, the performance seems to be really good, probably the best I've seen for fast error handling.