packages feed

HCL 1.7.1 → 1.8

raw patch · 4 files changed

+28/−15 lines, 4 filesdep ~basePVP ok

version bump matches the API change (PVP)

Dependency ranges changed: base

API changes (from Hackage documentation)

+ System.Console.HCL: instance Control.Monad.Fail.MonadFail System.Console.HCL.Request

Files

ChangeLog.md view
@@ -1,5 +1,11 @@ # HCL Change Log
 
+## v.1.8
+
+* updated to haskell stack
+* implemented MonadFail
+* better documentation
+
 ## v1.7.1
 
 * added `ChangeLog.md` to cabal file
HCL.cabal view
@@ -1,5 +1,5 @@ Name:           HCL-Version:        1.7.1+Version:        1.8 License:        BSD3 Author:         Justin Bailey Homepage:       http://github.com/m4dc4p/hcl/tree/master@@ -14,22 +14,25 @@   Dates, or other structured values), build lists of values, and use simple   menus. It is not intended to build complex interfaces with full cursor   control. It is oriented towards line-based interfaces.-cabal-version: >= 1.8+cabal-version: >= 1.10 extra-source-files: ChangeLog.md Data-files: hangman/2of12.txt  Library-  Build-Depends:  base >= 4.7 && < 5, QuickCheck == 2.*, mtl, random, containers+  default-language: Haskell2010+  Build-Depends:  base >= 4.9.0.0 && < 5, QuickCheck == 2.*, mtl, random, containers   Exposed-modules: System.Console.HCL   Hs-Source-Dirs: src  Executable hangman+  default-language: Haskell2010   Build-Depends:  base >= 4.7 && < 5, QuickCheck == 2.*, mtl, random, containers, HCL   Main-Is:        Hangman.hs   Hs-Source-Dirs: hangman   other-modules:  Paths_HCL  test-suite HCL-test+  default-language: Haskell2010   type: exitcode-stdio-1.0   main-is: Spec.hs   hs-source-dirs: test
LICENSE view
@@ -1,4 +1,4 @@-Copyright (c) 2009, Justin Bailey <jgbailey@gmail.com>+Copyright (c) 2009, 2018, 2021  Justin Bailey <jgbailey@gmail.com> All rights reserved.  Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
src/System/Console/HCL.hs view
@@ -350,12 +350,16 @@     fmap f' x
 
 {- |
-@'Request'@ behavior as a @"Monad"@ covers failure - when
-a request results in @Nothing@, all bind
-operations fail afterwards. Thus, when one request fails,
-all subsequent requests automatically fail. -}
+@'Request'@ behavior as a @"Monad"@ all bind operations fail
+afterwards. Thus, when one request fails, all subsequent requests
+automatically fail. -}
 instance Monad Request where
   f >>= g = f `andMaybe` g
+
+{- |
+Request behavior as a @MonadFail@ covers failure - when
+a request results in @Nothing@, -}
+instance MonadFail Request where
   fail _ = reqFail
 
 {- |
@@ -649,10 +653,10 @@     choice
 
 -- | Used to add an individual entry to a menu that is being built. 
-reqMenuItem :: String
-  -> Request a
-  -> [(String, Request a)]
-  -> [(String, Request a)]
+reqMenuItem :: String -- ^ the label for the selection
+  -> Request a -- ^ the @'Request'@ to run when selected
+  -> [(String, Request a)] -- ^ the menu being built
+  -> [(String, Request a)] -- ^ the resulting menu
 reqMenuItem label item = (:) (label, item) 
 
 -- | Creates a submenu within a menu. When the submenu exits, control returns to the item specified.
@@ -664,9 +668,9 @@ reqSubMenu prevMenu label subMenu = (:) (label, reqForever $ reqCont (reqMenu subMenu) prevMenu)  
 
 -- | Causes the program to exit from the current menu.  
-reqMenuExit :: String
-  -> [(String, Request a)]
-  -> [(String, Request a)]
+reqMenuExit :: String -- ^ the label, e.g.: @\"quit\"@
+  -> [(String, Request a)] -- ^ the menu being built
+  -> [(String, Request a)] -- ^ the resulting menu
 reqMenuExit label = (:) (label, reqFail)
 
 -- | Ends a list of menu item definitions.