Browse Source

Streamline is now a MonadBaseControl

Marcos Dumay de Medeiros 6 years ago
parent
commit
2bd53723c6
2 changed files with 11 additions and 1 deletions
  1. 10 1
      src/System/IO/Uniform/Streamline.hs
  2. 1 0
      uniform-io.cabal

+ 10 - 1
src/System/IO/Uniform/Streamline.hs

@@ -1,4 +1,4 @@
-{-# LANGUAGE OverloadedStrings, TypeFamilies #-}
+{-# LANGUAGE OverloadedStrings, TypeFamilies, MultiParamTypeClasses, FlexibleInstances, UndecidableInstances #-}
 
 {- |
 Streamline exports a monad that, given an uniform IO target, emulates
@@ -53,6 +53,7 @@ import Control.Monad.Trans.Class
 import Control.Monad.Trans.Interruptible
 import Control.Monad.Trans.Control
 import Control.Monad (ap, liftM)
+import Control.Monad.Base
 import Control.Monad.IO.Class
 import System.IO.Error
 import Data.ByteString (ByteString)
@@ -371,3 +372,11 @@ instance MonadTransControl Streamline where
                    liftM (\x -> (x, s))
                          (f $ \t -> withTarget' t s)
   restoreT = Streamline . const
+
+instance MonadBase b m => MonadBase b (Streamline m) where
+  liftBase = liftBaseDefault
+
+instance MonadBaseControl b m => MonadBaseControl b (Streamline m) where
+  type StM (Streamline m) a = ComposeSt Streamline m a
+  liftBaseWith     = defaultLiftBaseWith
+  restoreM         = defaultRestoreM

+ 1 - 0
uniform-io.cabal

@@ -109,6 +109,7 @@ library
       attoparsec >=0.13.0.1,
       data-default-class >= 0.0.1,
       monad-control,
+      transformers-base,
       interruptible
   
   -- Directories containing source files.