lue-bird/elm-morph/2.0.0

NOTE: the latest version is 3.0.1

Bit.Morph

Morph for a Bit

char : Morph Bit Char

'0' or '1'

n :
MorphIndependently
(N (In min_ (Up maxTo1_ To N1)) -> Result error_ Bit)
(Bit -> N (In (Up0 minX_) (Up1 maxX_)))

n0 ↔ O, n1 ↔ I

only : Bit -> Morph () Bit

Match a specific given Bit and not the other one.

import Morph
import Bit


Bit.O |> Morph.toNarrow (Bit.Morph.only Bit.I)
--> Err (Morph.DeadEnd "0")