README.md (1921B)
1 # urbit-hob 2 3 [![Build Status](https://travis-ci.org/urbit/urbit-hob.svg?branch=master)](https://travis-ci.org/urbit/urbit-hob) 4 [![Hackage Version](https://img.shields.io/hackage/v/urbit-hob.svg)](http://hackage.haskell.org/package/urbit-hob) 5 [![Stackage Version](http://stackage.org/package/urbit-hob/badge/nightly)](http://stackage.org/nightly/package/urbit-hob) 6 [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](https://opensource.org/licenses/MIT) 7 8 Utilities for phonetic base wrangling. 9 10 ## What 11 12 Here you can primarily find functions for dealing with the "patp" and "patq" 13 *phonetic bases* used by Urbit. The `@p` encoding is used for naming ships, 14 whereas the `@q` encoding is used for arbitrary data; they both uniquely 15 represent nonnegative integers (i.e. *atoms*) in a memorable and pronounceable 16 fashion. 17 18 The `@p` encoding is an *obfuscated* representation of an underlying atom, in 19 particular, hence the 'ob' in the library's name. 20 21 ## Usage 22 23 The library exposes two families of functions, `patp` and `fromPatp`, and then 24 `patq` and `fromPatq`, for converting between representations appropriately. 25 You can render `{patp, patq}` values via the `render{Patp, Patq}` functions, 26 and parse them from Text via `parse{Patp, Patq}` respectively. 27 28 The useful `clan` and `sein` functions, for determining a ship's class and 29 (default) parent, are also exposed. 30 31 Here are some quick examples: 32 33 ``` 34 > :set -XOverloadedStrings 35 > import qualified Urbit.Ob as Ob 36 > let nidsut = Ob.patp 15663360 37 > let marzod = Ob.patq (Ob.fromPatp nidsut) 38 > Ob.renderPatp nidsut 39 "~nidsut-tomdun" 40 > Ob.renderPatq marzod 41 "~mun-marzod" 42 > Ob.fromPatp nidsut 43 15663360 44 > Ob.parsePatp "~nidsut-tomdun" 45 Right ~nidsut-tomdun 46 > Ob.clan nidsut 47 Planet 48 > Ob.sein nidsut 49 ~marzod 50 ``` 51 52 ## See also 53 54 * [urbit-ob](https://github.com/urbit/urbit-ob) -- JavaScript bindings 55 * [urbit-gob](https://github.com/deelawn/urbit-gob) -- Go bindings