1module Snapshot.Variant01 where
5import Data.Variant (Variant, case_, inj, on)
6import Type.Proxy (Proxy(..))
8test1 :: Variant (foo :: Int, bar :: Boolean, baz :: String) -> String
10 # on (Proxy :: _ "foo") (\a -> show a)
11 # on (Proxy :: _ "bar") (\a -> show a)
12 # on (Proxy :: _ "baz") (\a -> a)
14test2 :: forall r. (Variant r -> String) -> Variant (foo :: Int, bar :: Boolean, baz :: String | r) -> String
16 on (Proxy :: _ "foo") (\a -> show a)
17 <<< on (Proxy :: _ "bar") (\a -> show a)
18 <<< on (Proxy :: _ "baz") (\a -> a)
20test3 :: forall r. Variant (foo :: Int | r)
21test3 = inj (Proxy :: _ "foo") 42
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