@@ -126,9 +126,8 @@ main' iniVal = initState iniVal >>= \s -> flip evalStateT s
126126 | s `Data.List.isPrefixOf` x = m args
127127 | otherwise = optMatcher s xs args
128128
129- ---------------------------------------------------------------------------------
129+
130130-- * Types
131- ---------------------------------------------------------------------------------
132131
133132data IState t f m = IState
134133 { replIt :: Maybe NExprLoc -- ^ Last expression entered
@@ -173,9 +172,8 @@ initState mIni = do
173172
174173type Repl e t f m = HaskelineT (StateT (IState t f m ) m )
175174
176- ---------------------------------------------------------------------------------
175+
177176-- * Execution
178- ---------------------------------------------------------------------------------
179177
180178exec
181179 :: forall e t f m
@@ -259,9 +257,8 @@ printValue val = do
259257 | cfgValues cfg -> liftIO . print . prettyNValueProv =<< removeEffects val
260258 | otherwise -> liftIO . print . prettyNValue =<< removeEffects val
261259
262- ---------------------------------------------------------------------------------
260+
263261-- * Commands
264- ---------------------------------------------------------------------------------
265262
266263-- :browse command
267264browse :: (MonadNix e t f m , MonadIO m )
@@ -293,16 +290,20 @@ typeof
293290 -> Repl e t f m ()
294291typeof args = do
295292 st <- get
296- mVal <- case Data.HashMap.Lazy. lookup line (replCtx st) of
297- Just val -> pure $ pure val
298- Nothing -> do
299- exec False line
293+ mVal <-
294+ case Data.HashMap.Lazy. lookup line (replCtx st) of
295+ Nothing -> exec False line
296+ Just val -> pure $ pure val
300297
301- for_ mVal $ \ val -> do
302- s <- lift . lift . showValueType $ val
303- liftIO $ putStrLn s
298+ traverse_ printValueType mVal
299+
300+ where
301+ line = Data.Text. pack args
302+ printValueType val =
303+ do
304+ s <- lift . lift . showValueType $ val
305+ liftIO $ putStrLn s
304306
305- where line = Data.Text. pack args
306307
307308-- :quit command
308309quit :: (MonadNix e t f m , MonadIO m ) => a -> Repl e t f m ()
@@ -317,9 +318,8 @@ setConfig args = case words args of
317318 [opt] -> modify (\ s -> s { replCfg = helpSetOptionFunction opt (replCfg s) })
318319 _ -> liftIO $ putStrLn " No such option"
319320
320- ---------------------------------------------------------------------------------
321+
321322-- * Interactive Shell
322- ---------------------------------------------------------------------------------
323323
324324-- Prefix tab completer
325325defaultMatcher :: MonadIO m => [(String , CompletionFunc m )]
0 commit comments