mirror of
https://github.com/unisonweb/unison.git
synced 2024-11-15 04:11:34 +03:00
Add Nat.fromText
This commit is contained in:
parent
aafbe93915
commit
5f1e072868
@ -22,3 +22,4 @@ The format for this list: name, GitHub handle, and then optional blurb about wha
|
||||
* Scott Christopher (@scott-christopher)
|
||||
* Alex Zolotko (@azolotko)
|
||||
* Ian Denhardt (@zenhack)
|
||||
* Mitchell Rosen (@mitchellwrosen)
|
||||
|
@ -241,6 +241,7 @@ builtinsSrc =
|
||||
, B "Nat.isOdd" $ nat --> boolean
|
||||
, B "Nat.toInt" $ nat --> int
|
||||
, B "Nat.toText" $ nat --> text
|
||||
, B "Nat.fromText" $ text --> optional nat
|
||||
|
||||
, B "Float.+" $ float --> float --> float
|
||||
, B "Float.-" $ float --> float --> float
|
||||
|
@ -331,6 +331,8 @@ builtinCompilationEnv = CompilationEnv (builtinsMap <> IR.builtins) mempty
|
||||
, mk1 "Float.truncate" atf (pure . I) truncate
|
||||
|
||||
, mk1 "Nat.toText" atn (pure . T) (Text.pack . show)
|
||||
, mk1 "Nat.fromText" att (pure . IR.maybeToOptional . fmap N) (
|
||||
(\x -> readMaybe x :: Maybe Word64) . Text.unpack)
|
||||
|
||||
-- Float Utils
|
||||
, mk1 "Float.abs" atf (pure . F) abs
|
||||
|
@ -185,7 +185,7 @@ library
|
||||
io-streams,
|
||||
lens,
|
||||
ListLike,
|
||||
megaparsec,
|
||||
megaparsec >= 5.0.0 && < 7.0.0,
|
||||
memory,
|
||||
mmorph,
|
||||
monad-loops,
|
||||
|
Loading…
Reference in New Issue
Block a user