A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/rowtype-yoga/purescript-fallback below:

rowtype-yoga/purescript-fallback: Idris-style fallback for purescript do comprehensions ⚡️

purescript-fallback

Idris-style fallback for do comprehensions.

purescript-fallback allows you to short-circuit a do-comprehension.

Installation
spago install fallback
Usage
withFallback do
    i :: String <- Nothing |> const (Just 0)
    result <- Int.fromString i |> const (Just 1)
    pure result
-- Just 0

withFallback do
    i :: String <- Just "abc" |> const (Just 0)
    result <- Int.fromString i |> const (Just 1)
    pure result
-- Just 1

withFallback do
    i :: String <- Just "10" |> const (Just 0)
    result <- Int.fromString i |> const (Just 1)
    pure result
-- Just 10

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4