| Copyright | (c) 2019 Jared Tobin |
|---|---|
| License | MIT |
| Maintainer | Jared Tobin <jared@jtobin.io> |
| Stability | unstable |
| Portability | ghc |
| Safe Haskell | None |
| Language | Haskell2010 |
Urbit.Ob.Co
Description
General functions for atom printing.
Roughly analogous to the +co arm in hoon.hoon.
Synopsis
- newtype Patp = Patp {
- unPatp :: ByteString
- newtype Patq = Patq {
- unPatq :: ByteString
- patp :: Natural -> Patp
- patq :: Natural -> Patq
- fromPatp :: Patp -> Natural
- fromPatq :: Patq -> Natural
- renderPatp :: Patp -> Text
- renderPatq :: Patq -> Text
- parsePatp :: Text -> Either Text Patp
- parsePatq :: Text -> Either Text Patq
Documentation
Hoon's @p encoding.
This encoding is an obfuscated representation of some underlying number, but a pronounceable, memorable, and unique one.
The representation exists for any natural number, but it's typically used only for naming Azimuth points, and thus normal 32-bit Urbit ships.
(It's also used for naming comets, i.e. self-signed 128-bit Urbit ships.)
Constructors
| Patp | |
Fields
| |
Instances
| Eq Patp Source # | |
| Ord Patp Source # | |
| Show Patp Source # | |
| Generic Patp Source # | |
| type Rep Patp Source # | |
Defined in Urbit.Ob.Co type Rep Patp = D1 (MetaData "Patp" "Urbit.Ob.Co" "urbit-hob-0.3.3-GmptVDoU9eA8sPD2nb7Adb" True) (C1 (MetaCons "Patp" PrefixI True) (S1 (MetaSel (Just "unPatp") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString))) | |
Hoon's @q encoding.
Unlike @p, the @q encoding is a non-obfuscated representation of an atom.
It's typically used for serializing arbitrary data in a memorable and pronounceable fashion.
Constructors
| Patq | |
Fields
| |
Instances
| Eq Patq Source # | |
| Ord Patq Source # | |
| Show Patq Source # | |
| Generic Patq Source # | |
| type Rep Patq Source # | |
Defined in Urbit.Ob.Co type Rep Patq = D1 (MetaData "Patq" "Urbit.Ob.Co" "urbit-hob-0.3.3-GmptVDoU9eA8sPD2nb7Adb" True) (C1 (MetaCons "Patq" PrefixI True) (S1 (MetaSel (Just "unPatq") NoSourceUnpackedness NoSourceStrictness DecidedLazy) (Rec0 ByteString))) | |
patp :: Natural -> Patp Source #
Convert a Natural to @p.
>>>patp 0~zod>>>patp 256~marzod>>>patp 65536~dapnep-ronmyl>>>patp 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~fipfes-fipfes-fipfes-fipfes--fipfes-fipfes-fipfes-fipfes
patq :: Natural -> Patq Source #
Convert a Natural to @q.
>>>patq 0~zod>>>patp 256~marzod>>>patp 65536~nec-dozzod>>>patp 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF~fipfes-fipfes-fipfes-fipfes-fipfes-fipfes-fipfes-fipfes
fromPatp :: Patp -> Natural Source #
Convert a @p value to its corresponding Natural.
>>>let zod = patp 0>>>fromPatp zod0
fromPatq :: Patq -> Natural Source #
Convert a @q value to its corresponding Natural.
>>>let zod = patq 0>>>fromPatq zod0
renderPatp :: Patp -> Text Source #
Render a @p value as Text.
>>>renderPatp (patp 0)"~zod">>>renderPatp (patp 15663360)"~nidsut-tomdun"
renderPatq :: Patq -> Text Source #
Render a @p value as Text.
>>>renderPatq (patq 0)"~zod">>>renderPatq (patq 15663360)"~mun-marzod"