Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
jberryman
GHC
Commits
0aabb948
Commit
0aabb948
authored
Nov 12, 2009
by
simonpj@microsoft.com
Browse files
Add an ID monad to MonadUtils (used in kind checking)
parent
c55eee3a
Changes
1
Hide whitespace changes
Inline
Side-by-side
compiler/utils/MonadUtils.hs
View file @
0aabb948
...
...
@@ -8,6 +8,8 @@ module MonadUtils
,
MonadFix
(
..
)
,
MonadIO
(
..
)
,
ID
,
runID
,
liftIO1
,
liftIO2
,
liftIO3
,
liftIO4
...
...
@@ -22,6 +24,8 @@ module MonadUtils
,
maybeMapM
)
where
import
Outputable
----------------------------------------------------------------------------------------
-- Detection of available libraries
----------------------------------------------------------------------------------------
...
...
@@ -42,6 +46,20 @@ import Control.Monad.Trans
import
Control.Monad
import
Control.Monad.Fix
----------------------------------------------------------------------------------------
-- The ID monad
----------------------------------------------------------------------------------------
newtype
ID
a
=
ID
a
instance
Monad
ID
where
return
x
=
ID
x
(
ID
x
)
>>=
f
=
f
x
_
>>
y
=
y
fail
s
=
panic
s
runID
::
ID
a
->
a
runID
(
ID
x
)
=
x
----------------------------------------------------------------------------------------
-- MTL
----------------------------------------------------------------------------------------
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment