Open-Awesome
CategoriesAlternativesStacksSelf-HostedExplore
Open-Awesome

© 2026 Open-Awesome. Curated for the developer elite.

TermsPrivacyAboutGitHubRSS
  1. Home
  2. Elixir
  3. witchcraft

witchcraft

MITElixir

A library providing common algebraic and categorical abstractions like monoids, functors, and monads to Elixir.

Visit WebsiteGitHubGitHub
1.2k stars60 forks0 contributors

What is witchcraft?

Witchcraft is an Elixir library that provides common algebraic and categorical abstractions, such as monoids, functors, monads, arrows, and categories. It solves the problem of bringing principled functional programming patterns to Elixir, enabling more declarative and composable code while staying true to the language's idioms.

Target Audience

Elixir developers interested in functional programming patterns, especially those familiar with concepts from Haskell, Scala, or Fantasy Land who want to apply them in Elixir projects.

Value Proposition

Developers choose Witchcraft because it offers a clean, idiomatic implementation of functional abstractions tailored for Elixir, with beginner-friendly documentation, seamless integration into existing codebases, and a focus on practicality without sacrificing mathematical rigor.

Overview

Monads and other dark magic for Elixir

Use Cases

Best For

  • Implementing monadic error handling in Elixir pipelines
  • Writing composable, declarative business logic using functors and applicatives
  • Extending Elixir's standard library operators to work with custom data types
  • Learning functional programming concepts in a familiar Elixir context
  • Building libraries that require algebraic abstractions like monoids or categories
  • Integrating Fantasy Land-style type classes into Elixir projects

Not Ideal For

  • Projects relying exclusively on Elixir's tuple-based error handling without monadic patterns
  • Teams that strictly avoid overriding Elixir's core operators to maintain code predictability
  • Performance-critical systems where abstraction layers could introduce measurable latency
  • Developers seeking static type guarantees; Witchcraft works within Elixir's dynamic typing

Pros & Cons

Pros

Algebraic Abstractions

Implements a full type class hierarchy including Semigroup, Monoid, Functor, and Monad, enabling principled functional programming in Elixir as detailed in the README's type class chart.

Elixir Idiomatic Design

Honors Elixir's pipe-first data flow and expands standard operators like `<>` to work on any monoid, ensuring seamless integration with the language's conventions.

Beginner-Friendly Documentation

Provides clear examples via doctests and avoids requiring knowledge of other languages, making advanced concepts accessible to Elixir developers.

Gradual Adoption Support

Compatible with regular Elixir code without enforcing strict types, allowing incremental integration into existing projects as emphasized in the pragmatism section.

Property-Based Correctness

Uses TypeClass to enforce type class properties at compile time, ensuring custom instances adhere to mathematical laws and reducing runtime errors.

Cons

Kernel Operator Overrides

Overrides core Elixir operators like `<>` and `~>`, which can cause conflicts or unexpected behavior in mixed codebases, despite the option to disable overrides.

Steep Conceptual Learning Curve

Requires familiarity with algebraic abstractions like monads and categories, posing a barrier for developers new to functional programming paradigms.

Dependency Chain Complexity

Relies on a family of libraries (Quark, TypeClass, Algae) for full functionality, adding to dependency management and potential versioning issues.

Limited Real-World Examples

While documentation includes doctests, practical, large-scale use cases are less prevalent compared to more established Elixir libraries, making adoption cautious.

Frequently Asked Questions

Quick Stats

Stars1,232
Forks60
Contributors0
Open Issues22
Last commit2 years ago
CreatedSince 2015

Tags

#functional-programming#elixir#category-theory#monad#algebraic-data-types#fantasy-land#applicative#operators#elixir-library#algebra#traversable#category#type-classes#monads#haskell-inspired#functor

Built With

E
Elixir

Links & Resources

Website

Included in

Elixir13.1k
Auto-fetched 5 hours ago

Related Projects

flowflow

Computational parallel flows on top of GenStage

Stars1,613
Forks88
Last commit1 year ago
machinerymachinery

Elixir State machine thin layer for structs

Stars564
Forks55
Last commit2 years ago
fusefuse

A Circuit Breaker for Erlang

Stars513
Forks51
Last commit4 years ago
matrexmatrex

A blazing fast matrix library for Elixir/Erlang with C implementation using CBLAS.

Stars489
Forks32
Last commit5 years ago
Community-curated · Updated weekly · 100% open source

Found a gem we're missing?

Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.

Submit a projectStar on GitHub