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: 5 months 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 (about 8 years ago)
- Default Branch: master
- Last Pushed: 2018-05-24T19:01:13.000Z (about 8 years ago)
- Last Synced: 2025-05-16T15:50:25.629Z (about 1 year ago)
- Topics: purescript, sized, type-level
- Language: PureScript
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 2
- 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

## Usage
```hs
main :: Effect Unit
main = do
log "Empty"
let (empty :: D.SizedList "" Int) = D.empty
logShow empty
log "Singleton"
let
-- inferred:
-- (b :: SizedList "." Int)
singleton
= D.singleton 1
logShow singleton
log "toList of singleton"
let list = D.toList singleton
logShow list
log "toList of singleton"
let nonEmptyList = D.toList singleton
logShow nonEmptyList
log "head of singleton"
let head = D.head singleton
logShow head
-- correct compile error:
-- let head' = D.head empty
log "tail of singleton"
let
-- inferred
-- (tail :: SizedList "" Int)
tail
= D.tail singleton
logShow tail
-- correct compile error:
-- let tail' = D.tail empty
log "append two singletons"
let
-- inferred
-- (append :: SizedList ".." Int)
append
= D.append singleton singleton
logShow append
log "Finished"
```