Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/justinwoo/purescript-dango
A fun library for sized lists in PureScript 0.12 using Symbols
https://github.com/justinwoo/purescript-dango
purescript sized type-level
Last synced: 29 days ago
JSON representation
A fun library for sized lists in PureScript 0.12 using Symbols
- Host: GitHub
- URL: https://github.com/justinwoo/purescript-dango
- Owner: justinwoo
- Created: 2018-05-24T18:59:16.000Z (over 6 years ago)
- Default Branch: master
- Last Pushed: 2018-05-24T19:01:13.000Z (over 6 years ago)
- Last Synced: 2024-11-14T02:07:14.828Z (2 months ago)
- Topics: purescript, sized, type-level
- Language: PureScript
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# PureScript-Dango
A fun library for sized lists in PureScript 0.12 using Symbols
![](https://i.imgur.com/zAAgsSN.jpg)
## Usage
```hs
main :: Effect Unit
main = do
log "Empty"
let (empty :: D.SizedList "" Int) = D.empty
logShow emptylog "Singleton"
let
-- inferred:
-- (b :: SizedList "." Int)
singleton
= D.singleton 1
logShow singletonlog "toList of singleton"
let list = D.toList singleton
logShow listlog "toList of singleton"
let nonEmptyList = D.toList singleton
logShow nonEmptyListlog "head of singleton"
let head = D.head singleton
logShow head-- correct compile error:
-- let head' = D.head emptylog "tail of singleton"
let
-- inferred
-- (tail :: SizedList "" Int)
tail
= D.tail singleton
logShow tail-- correct compile error:
-- let tail' = D.tail emptylog "append two singletons"
let
-- inferred
-- (append :: SizedList ".." Int)
append
= D.append singleton singleton
logShow appendlog "Finished"
```