1module ProjectM36.DataTypes.Either where
3import ProjectM36.AtomFunction
4import qualified Data.HashSet as HS
5import qualified Data.Map as M
7eitherAtomType :: AtomType -> AtomType -> AtomType
8eitherAtomType tA tB = ConstructedAtomType "Either" (M.fromList [("a", tA), ("b", tB)])
10eitherTypeConstructorMapping :: TypeConstructorMapping
11eitherTypeConstructorMapping = [(ADTypeConstructorDef "Either" ["a", "b"],
12 [DataConstructorDef "Left" [DataConstructorDefTypeVarNameArg "a"],
13 DataConstructorDef "Right" [DataConstructorDefTypeVarNameArg "b"]])]
15eitherAtomFunctions :: AtomFunctions
16eitherAtomFunctions = HS.fromList [
17 compiledAtomFunction "isLeft" [eitherAtomType (TypeVariableType "a") (TypeVariableType "b"), BoolAtomType] $ \(ConstructedAtom dConsName _ _:_) -> pure (BoolAtom (dConsName == "Left"))
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