From 0bc58352bbf230e05cb5b1b63015f2da7fcad051 Mon Sep 17 00:00:00 2001 From: Paul Chiusano Date: Tue, 23 Oct 2018 09:45:39 -0400 Subject: [PATCH] stubbed out menu interface --- parser-typechecker/src/Unison/Util/Menu.hs | 57 +++++++++++++++++++ .../unison-parser-typechecker.cabal | 9 +-- 2 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 parser-typechecker/src/Unison/Util/Menu.hs diff --git a/parser-typechecker/src/Unison/Util/Menu.hs b/parser-typechecker/src/Unison/Util/Menu.hs new file mode 100644 index 000000000..34f378781 --- /dev/null +++ b/parser-typechecker/src/Unison/Util/Menu.hs @@ -0,0 +1,57 @@ +module Unison.Util.Menu where + +-- utility - command line menus + +type Caption = String +type Stylized = String -- todo upgrade this to a doc +type Keyword = String +type MetaChoice = String +type Console = IO Char + +{- + + + 1 ping + pong + 2 foo + 3 bar + + [cancel] + [help] + + >> ping + + -} +menu1 :: Console + -> Caption + -> (a -> Stylized) + -> (MetaChoice -> Stylized) + -> [[(Keyword, a)]] + -> [([Keyword], MetaChoice)] + -> IO (Either MetaChoice [a]) +menu1 _console _caption _render _renderMeta _groups _metas = pure (Right []) + +{- + + + 1 ping + pong + 2 foo + 3 bar + + [all] + [cancel] + [help] + + >> 1 3 + >> * + + -} +menuN :: Console + -> Caption + -> (a -> Stylized) + -> (MetaChoice -> Stylized) + -> [[(Keyword, a)]] + -> [([Keyword], MetaChoice)] + -> IO (Either MetaChoice [[a]]) +menuN _console _caption _render _renderMeta _groups _metas = pure (Right []) diff --git a/parser-typechecker/unison-parser-typechecker.cabal b/parser-typechecker/unison-parser-typechecker.cabal index b5c402d9a..c71eb7090 100644 --- a/parser-typechecker/unison-parser-typechecker.cabal +++ b/parser-typechecker/unison-parser-typechecker.cabal @@ -47,10 +47,10 @@ library Unison.Codebase.NameEdit Unison.Codebase.Runtime Unison.Codebase.Runtime.JVM - Unison.Codebase.TermEdit - Unison.Codebase.TypeEdit Unison.Codebase.Serialization Unison.Codebase.Serialization.V0 + Unison.Codebase.TermEdit + Unison.Codebase.TypeEdit Unison.Codebase.Watch Unison.DataDeclaration Unison.FileParser @@ -68,8 +68,8 @@ library Unison.PrettyPrint Unison.PrintError Unison.Reference - Unison.Runtime.Rt0 Unison.Result + Unison.Runtime.Rt0 Unison.Settings Unison.Symbol Unison.Term @@ -80,14 +80,15 @@ library Unison.TypePrinter Unison.TypeVar Unison.Typechecker - Unison.Typechecker.Context Unison.Typechecker.Components + Unison.Typechecker.Context Unison.Typechecker.Extractor Unison.Typechecker.TypeError Unison.UnisonFile Unison.Util.AnnotatedText Unison.Util.ColorText Unison.Util.Logger + Unison.Util.Menu Unison.Util.Monoid Unison.Util.PrettyPrint Unison.Util.Range