1-- @inline export variantBuildMatchCons arity=5
2module Snapshot.Variant02 where
6import Data.Symbol (class IsSymbol)
7import Data.Variant (Variant, case_, on)
9import Prim.RowList (class RowToList, RowList)
10import Prim.RowList as RowList
11import Record as Record
12import Type.Equality (class TypeEquals)
13import Type.Proxy (Proxy(..))
15class VariantBuildMatch (rl :: RowList Type) r1 r2 r3 z where
16 variantBuildMatch :: Proxy rl -> (Variant r1 -> z) -> r2 -> Variant r3 -> z
18instance variantBuildMatchCons ::
19 ( TypeEquals f (a -> z)
20 , Row.Cons sym (a -> z) r2' r2
21 , Row.Cons sym a r3' r3
23 , VariantBuildMatch rl r1 { | r2 } r3' z
25 VariantBuildMatch (RowList.Cons sym f rl) r1 { | r2 } r3 z where
26 variantBuildMatch _ k r =
27 on (Proxy :: _ sym) (Record.get (Proxy :: _ sym) r)
28 (variantBuildMatch (Proxy :: _ rl) k r)
30instance variantBuildMatchNil :: VariantBuildMatch RowList.Nil r1 r2 r1 z where
31 variantBuildMatch _ k _ = k
36 => VariantBuildMatch rl () { | r1 } r2 z
40match = variantBuildMatch (Proxy :: _ rl) case_
42test1 :: Variant (foo :: Int, bar :: Boolean, baz :: String) -> String
keysesc to close
- j k
- move down, up
- enter
- open
- esc
- back, or up a level
- 1 2 3 4
- readme, files, commits, refs
- /
- filter
- y
- copy the clone command
- c
- compare the chosen commit with another (or shift-click both)
- ?
- show or hide this list