Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/urbit/urbit-hob
Haskell utilities for Hoon-style atom printing and conversion
https://github.com/urbit/urbit-hob
Last synced: about 2 months ago
JSON representation
Haskell utilities for Hoon-style atom printing and conversion
- Host: GitHub
- URL: https://github.com/urbit/urbit-hob
- Owner: urbit
- License: mit
- Created: 2019-09-06T08:29:49.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2022-04-01T11:51:29.000Z (over 2 years ago)
- Last Synced: 2024-10-03T14:38:32.149Z (3 months ago)
- Language: Haskell
- Size: 68.4 KB
- Stars: 9
- Watchers: 21
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG
- License: LICENSE
Awesome Lists containing this project
README
# urbit-hob
[![Build Status](https://travis-ci.org/urbit/urbit-hob.svg?branch=master)](https://travis-ci.org/urbit/urbit-hob)
[![Hackage Version](https://img.shields.io/hackage/v/urbit-hob.svg)](http://hackage.haskell.org/package/urbit-hob)
[![Stackage Version](http://stackage.org/package/urbit-hob/badge/nightly)](http://stackage.org/nightly/package/urbit-hob)
[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT)Utilities for phonetic base wrangling.
## What
Here you can primarily find functions for dealing with the "patp" and "patq"
*phonetic bases* used by Urbit. The `@p` encoding is used for naming ships,
whereas the `@q` encoding is used for arbitrary data; they both uniquely
represent nonnegative integers (i.e. *atoms*) in a memorable and pronounceable
fashion.The `@p` encoding is an *obfuscated* representation of an underlying atom, in
particular, hence the 'ob' in the library's name.## Usage
The library exposes two families of functions, `patp` and `fromPatp`, and then
`patq` and `fromPatq`, for converting between representations appropriately.
You can render `{patp, patq}` values via the `render{Patp, Patq}` functions,
and parse them from Text via `parse{Patp, Patq}` respectively.The useful `clan` and `sein` functions, for determining a ship's class and
(default) parent, are also exposed.Here are some quick examples:
```
> :set -XOverloadedStrings
> import qualified Urbit.Ob as Ob
> let nidsut = Ob.patp 15663360
> let marzod = Ob.patq (Ob.fromPatp nidsut)
> Ob.renderPatp nidsut
"~nidsut-tomdun"
> Ob.renderPatq marzod
"~mun-marzod"
> Ob.fromPatp nidsut
15663360
> Ob.parsePatp "~nidsut-tomdun"
Right ~nidsut-tomdun
> Ob.clan nidsut
Planet
> Ob.sein nidsut
~marzod
```## See also
* [urbit-ob](https://github.com/urbit/urbit-ob) -- JavaScript bindings
* [urbit-gob](https://github.com/deelawn/urbit-gob) -- Go bindings