mirror of
https://github.com/idris-lang/Idris2.git
synced 2024-09-21 10:18:23 +03:00
Merge pull request #86 from andylokandy/just
Add a total version of the fromMaybe
This commit is contained in:
commit
215ad99308
@ -32,6 +32,12 @@ fromMaybe : (Lazy a) -> Maybe a -> a
|
||||
fromMaybe def Nothing = def
|
||||
fromMaybe def (Just j) = j
|
||||
|
||||
||| Returns the `a` value of a `Maybe a` which is proved `Just`.
|
||||
public export
|
||||
fromJust : (v : Maybe a) -> IsJust v => a
|
||||
fromJust (Just x) = x
|
||||
fromJust Nothing impossible
|
||||
|
||||
||| Returns `Just` the given value if the conditional is `True`
|
||||
||| and `Nothing` if the conditional is `False`.
|
||||
public export
|
||||
|
Loading…
Reference in New Issue
Block a user