Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/int-index/union
Extensible type-safe unions for Haskell
https://github.com/int-index/union
Last synced: 3 months ago
JSON representation
Extensible type-safe unions for Haskell
- Host: GitHub
- URL: https://github.com/int-index/union
- Owner: int-index
- License: bsd-3-clause
- Created: 2016-02-02T22:37:07.000Z (almost 9 years ago)
- Default Branch: master
- Last Pushed: 2024-09-10T10:24:03.000Z (4 months ago)
- Last Synced: 2024-10-11T23:53:05.863Z (3 months ago)
- Language: Haskell
- Size: 25.4 KB
- Stars: 31
- Watchers: 5
- Forks: 2
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Union
[![Build Status](https://github.com/int-index/union/workflows/CI/badge.svg)](https://github.com/int-index/union/actions)
[![Hackage](https://img.shields.io/hackage/v/union.svg)](https://hackage.haskell.org/package/union)Extensible type-safe unions.
```
ghci> let a = openUnion # (5 :: Int) :: OpenUnion '[Bool, Int]ghci> a ^? openUnion :: Maybe Int
Just 5ghci> a ^? openUnion :: Maybe Bool
Nothingghci> a ^? openUnion :: Maybe Char
:8:6:
No instance for (UElem Char '[] (RIndex Char '[]))
arising from a use of ‘openUnion’
In the second argument of ‘(^?)’, namely ‘openUnion’
In the expression: a ^? openUnion :: Maybe Char
In an equation for ‘it’: it = a ^? openUnion :: Maybe Char
```