File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed
inline-r/src/Control/Monad/R Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change 1
1
-- |
2
2
-- Copyright: (C) 2016 Tweag I/O Limited.
3
3
4
+ {-# OPTIONS_GHC -fplugin-opt=LiquidHaskell:--skip-module=False #-}
4
5
{-# LANGUAGE FlexibleContexts #-}
5
6
{-# LANGUAGE RankNTypes #-}
6
7
{-# LANGUAGE ScopedTypeVariables #-}
@@ -12,14 +13,20 @@ import Control.Monad.R.Class
12
13
import Data.Proxy (Proxy (.. ))
13
14
import Data.Reflection (Reifies , reify )
14
15
import Foreign.R (SEXP )
16
+ import Foreign.R.Context -- XXX: Needed to help LH name resolution
17
+ import Foreign.R.Internal -- XXX: Needed to help LH name resolution
15
18
16
- newtype AcquireIO s = AcquireIO (forall ty . SEXP V ty -> IO (SEXP s ty ))
19
+ {-@ type AcquireIO s = forall < p :: SEXP s -> Bool > . (SEXP V )< p > -> IO ((SEXP s )< p > ) @-}
20
+ type AcquireIO s = SEXP V -> IO (SEXP s )
17
21
22
+ -- XXX: It is not possible to give a specification to withAcquire.
23
+ -- Apparently the constraints of the nested function can't be expressed in
24
+ -- specs.
18
25
withAcquire
19
26
:: forall m r .
20
27
(MonadR m )
21
28
=> (forall s . Reifies s (AcquireIO (Region m )) => Proxy s -> m r )
22
29
-> m r
23
30
withAcquire f = do
24
31
cxt <- getExecContext
25
- reify (AcquireIO ( \ sx -> unsafeRunWithExecContext (acquire sx) cxt) ) f
32
+ reify (\ sx -> unsafeRunWithExecContext (acquire sx) cxt) f
You can’t perform that action at this time.
0 commit comments