summaryrefslogtreecommitdiff
path: root/lec07/Editor.hs
diff options
context:
space:
mode:
authorEdoardo La Greca2025-09-26 20:00:08 +0200
committerEdoardo La Greca2025-09-26 20:00:08 +0200
commit7993c4c6cb3536f25cde7686535ebc00242a6bcd (patch)
treec055c306b89b59e7e01af167437448a81a2abdac /lec07/Editor.hs
parent3f68acafbaf6c5d8c5d340fd85a72db186140fa1 (diff)
fix given code of lecture 7 due to breaking changes in haskell (thanks Giacomo Cavalieri!! :D)
Diffstat (limited to 'lec07/Editor.hs')
-rw-r--r--lec07/Editor.hs3
1 files changed, 2 insertions, 1 deletions
diff --git a/lec07/Editor.hs b/lec07/Editor.hs
index 8f35414..8271118 100644
--- a/lec07/Editor.hs
+++ b/lec07/Editor.hs
@@ -10,6 +10,7 @@ import Buffer
import Control.Exception
import Control.Monad.State
+import Control.Monad (when, zipWithM_)
import Control.Applicative
import Control.Arrow (first, second)
@@ -35,7 +36,7 @@ commands = map show [View, Edit, Next, Prev, Quit]
-- Editor monad
newtype Editor b a = Editor (StateT (b,Int) IO a)
- deriving (Functor, Monad, MonadIO, MonadState (b,Int))
+ deriving (Functor, Applicative, Monad, MonadIO, MonadState (b,Int))
runEditor :: Buffer b => Editor b a -> b -> IO a
runEditor (Editor e) b = evalStateT e (b,0)