summaryrefslogtreecommitdiffhomepage
path: root/Types/UI.hs
blob: 553c32323ef022fceb659e15e7cf9159097b2ef7 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
{- Copyright 2016 Joey Hess <id@joeyh.name>
 -
 - Licensed under the GNU AGPL version 3 or higher.
 -}

{-# LANGUAGE RankNTypes #-}

module Types.UI where

import Types

data UI = UI
	{ isAvailable :: IO Bool
	, showError :: Desc -> IO ()
	, showInfo :: Title -> Desc -> IO ()
	, promptQuestion :: Title -> Desc -> Question -> IO Bool
	, promptName :: Title -> Desc -> Maybe Name -> (Name -> Maybe Problem) -> IO (Maybe Name)
	, promptPassword :: Bool -> Title -> Desc -> IO (Maybe Password)
	, promptKeyId :: Title -> Desc -> [(Name, KeyId)] -> IO (Maybe KeyId)
	, withProgress :: forall a. Title -> Desc -> ((Percent -> IO ()) -> IO a) -> IO a
	}

type Title = String
type Desc = String
type Percent = Int
type Problem = String
type Question = String