aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Sunet <jeannekamikaze@gmail.com>2012-08-30 20:59:33 +0200
committerMarc Sunet <jeannekamikaze@gmail.com>2012-08-30 20:59:33 +0200
commit2f1848cb872419628bdf3180d337661de8a6d98e (patch)
tree9febcf6ef9f41b25523e212c211a510c388bf742
parentf7d94a136603e57a6c2fe129f47b93d429cbb338 (diff)
Added assertMaybe
-rw-r--r--Spear.lkshw2
-rw-r--r--Spear/Setup.hs7
2 files changed, 8 insertions, 1 deletions
diff --git a/Spear.lkshw b/Spear.lkshw
index 2dd5288..f062526 100644
--- a/Spear.lkshw
+++ b/Spear.lkshw
@@ -1,7 +1,7 @@
1Version of workspace file format: 1Version of workspace file format:
2 1 2 1
3Time of storage: 3Time of storage:
4 "Thu Aug 30 20:54:09 CEST 2012" 4 "Thu Aug 30 20:57:58 CEST 2012"
5Name of the workspace: 5Name of the workspace:
6 "Spear" 6 "Spear"
7File paths of contained packages: 7File paths of contained packages:
diff --git a/Spear/Setup.hs b/Spear/Setup.hs
index cfe379c..e7917cf 100644
--- a/Spear/Setup.hs
+++ b/Spear/Setup.hs
@@ -8,6 +8,7 @@ module Spear.Setup
8, runSetup_ 8, runSetup_
9, setupError 9, setupError
10, setupIO 10, setupIO
11, assertMaybe
11) 12)
12where 13where
13 14
@@ -50,3 +51,9 @@ setupError = MT.lift . throwError
50-- | Lift the given IO action into the 'Setup' monad. 51-- | Lift the given IO action into the 'Setup' monad.
51setupIO :: IO a -> Setup a 52setupIO :: IO a -> Setup a
52setupIO = MT.lift . MT.lift 53setupIO = MT.lift . MT.lift
54
55
56-- | Throw the given error string if given 'Nothing'.
57assertMaybe :: Maybe a -> String -> Setup ()
58assertMaybe Nothing err = setupError err
59assertMaybe _ _ = return ()