-
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
23c17a9
commit 982b366
Showing
75 changed files
with
1,266 additions
and
573 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s . | ||
#curl -sSL https://raw.github.com/ndmitchell/hlint/master/misc/run.sh | sh -s . | ||
hlint . --report=hlint.html --timing | ||
|
||
mv hlint.html docs/reports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
module HelVM.Common.Control.Control ( | ||
controlTToIO, | ||
controlToIO, | ||
|
||
runControlT, | ||
runControl, | ||
|
||
safeWithMessagesToText, | ||
|
||
controlT, | ||
control, | ||
|
||
safeWithMessages, | ||
|
||
MonadControl, | ||
ControlT, | ||
Control, | ||
|
||
UnitSafeWithMessages, | ||
SafeWithMessages | ||
) where | ||
|
||
import HelVM.Common.Control.Logger | ||
import HelVM.Common.Control.Message | ||
import HelVM.Common.Control.Safe | ||
|
||
import Control.Type.Operator | ||
|
||
controlTToIO :: ControlT IO a -> IO a | ||
controlTToIO a = safeWithMessagesToIO =<< runControlT a | ||
|
||
controlToIO :: Control a -> IO a | ||
controlToIO = safeToIO . removeLogger | ||
|
||
runControlT :: ControlT m a -> m $ SafeWithMessages a | ||
runControlT = runLoggerT . runSafeT | ||
|
||
runControl :: Control a -> SafeWithMessages a | ||
runControl a = runLogger $ runSafe <$> a | ||
|
||
safeWithMessagesToIO :: SafeWithMessages a -> IO a | ||
safeWithMessagesToIO (safe , _) = safeToIO safe | ||
|
||
safeWithMessagesToText :: SafeWithMessages a -> Text | ||
safeWithMessagesToText (safe , messages) = errorsToText messages <> safeToText safe | ||
|
||
-- | Constructors | ||
|
||
controlT :: Monad m => m a -> ControlT m a | ||
controlT = safeT . loggerT | ||
|
||
control :: a -> Control a | ||
control = logger . pure | ||
|
||
safeWithMessages :: a -> SafeWithMessages a | ||
safeWithMessages = withMessages . pure | ||
|
||
-- | Types | ||
|
||
type MonadControl m = (MonadLogger m, MonadSafe m) | ||
|
||
type ControlT m = SafeT (LoggerT m) | ||
|
||
type Control a = Logger $ Safe a | ||
|
||
type UnitSafeWithMessages = SafeWithMessages () | ||
|
||
type SafeWithMessages a = WithMessages (Safe a) |
Oops, something went wrong.