diff options
author | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-30 20:59:33 +0200 |
---|---|---|
committer | Marc Sunet <jeannekamikaze@gmail.com> | 2012-08-30 20:59:33 +0200 |
commit | 2f1848cb872419628bdf3180d337661de8a6d98e (patch) | |
tree | 9febcf6ef9f41b25523e212c211a510c388bf742 | |
parent | f7d94a136603e57a6c2fe129f47b93d429cbb338 (diff) |
Added assertMaybe
-rw-r--r-- | Spear.lkshw | 2 | ||||
-rw-r--r-- | Spear/Setup.hs | 7 |
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 @@ | |||
1 | Version of workspace file format: | 1 | Version of workspace file format: |
2 | 1 | 2 | 1 |
3 | Time of storage: | 3 | Time of storage: |
4 | "Thu Aug 30 20:54:09 CEST 2012" | 4 | "Thu Aug 30 20:57:58 CEST 2012" |
5 | Name of the workspace: | 5 | Name of the workspace: |
6 | "Spear" | 6 | "Spear" |
7 | File paths of contained packages: | 7 | File 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 | ) |
12 | where | 13 | where |
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. |
51 | setupIO :: IO a -> Setup a | 52 | setupIO :: IO a -> Setup a |
52 | setupIO = MT.lift . MT.lift | 53 | setupIO = MT.lift . MT.lift |
54 | |||
55 | |||
56 | -- | Throw the given error string if given 'Nothing'. | ||
57 | assertMaybe :: Maybe a -> String -> Setup () | ||
58 | assertMaybe Nothing err = setupError err | ||
59 | assertMaybe _ _ = return () | ||