Skip to content

A library for Unison (https://www.unisonweb.org) that provides a Read ability, along with some combinators and handlers, that allow for incrementally consuming some values to produce a result or fail

Notifications You must be signed in to change notification settings

thoradam/unison-read

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

unison-read

Provides a Read a ability, along with some combinators and handlers, that allows for incrementally consuming some as to produce a result or fail.

Example

csv : '{Read Char} [[Text]]
csv = 'let
  cell = '(fromCharList (any '(none [?\n, ?,])))
  cells = '(!cell +: or more '[])
  more = '('(one ?,) *> cells)
  lines = '(!cells +: or moreLines '[])
  moreLines = '('(one ?\n) *> lines)
  !lines

> readText csv "123,123,123\n12,12\n1"
    ⧩
    ReadResult
    (3, 1)
    (Right
        [ ["123", "123", "123"],
        ["12", "12"],
        ["1"] ])

Install

.> pull https://github.com/thoradam/unison-read:.releases._v1 .external.read.v1

About

A library for Unison (https://www.unisonweb.org) that provides a Read ability, along with some combinators and handlers, that allow for incrementally consuming some values to produce a result or fail

Topics

Resources

Stars

Watchers

Forks