-
Notifications
You must be signed in to change notification settings - Fork 1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Stack overflow! #13
Comments
runReader
:: forall (s :: Symbol) rho r a p
. ( Lacks rho s
, Lacks p "id"
, rho ~ Ext p "id" Identity
)
=> r
-> Eff (rho .& s .= (Reader r)) a
-> Eff rho a
runReader r eff = run (runReaderF @s r) eff Together with a app :: Eff (Reading "reader" Int Base) Int
app = do
s <- ask @"reader"
pure (10 * s)
result :: Int
result = runPure (runReader @"reader" 2 app) and GHCi says This is sort of a progress report, isn't it? :) |
I'm away from my computer right now. Do you get a different behavior if you
refactor a bit to avoid needing `-XAllowAmbiguousTypes`? (And maybe even
`-XNoMonomorphismRestriction`?)
Unrelated (I hope!): you might try using the `Data.Sculls.RAll` constraint
instead of `Wrap`.
…On Sun, Oct 22, 2017, 10:15 Soham Chowdhury ***@***.***> wrote:
It's a sensible function, however:
runReader
:: forall (s :: Symbol) rho r a p
. ( Lacks rho s
, Lacks p "id"
, rho ~ Ext p "id" Identity
)
=> r
-> Eff (rho .& s .= (Reader r)) a
-> Eff rho a
runReader r eff = run (runReaderF @s r) eff
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABDg060Jea5GoJ39RG7_FQPi23JPRHBfks5su3g5gaJpZM4QCBWA>
.
|
An erratum to this comment: the version that triggered the stack overflow wasn't actually sensible and would never have typechecked. Disabling runReaderF
:: forall (s :: Symbol) rho' rho r a p proxy
. ( Lacks rho' s
, Lacks p "id"
, rho' ~ Ext p "id" Identity
, rho ~ Ext rho' s (Reader r)
)
=> proxy s -> r
-> Var rho (Eff rho a)
-> Eff rho' (Eff rho a)
runReaderF _ r (Var v) = (Eff . liftF) =<< (Eff (Pure var))
where
var = case v .- (Proxy @s) of
Left l -> Var l
Right (Wrap (Reader ra)) -> Var (mkV' (Wrap (pure (ra r))))
where
mkV'
:: Wrap (Eff rho a) "id" Identity
-> V (Wrap (Eff rho a)) (p .& "id" .= Identity)
mkV' = mkV
runReader = run (runReaderF (Proxy :: Proxy "reader")) This triggers the same stack overflow. Additionally disabling
|
The problem is with inference for the last line, AFAICT: commenting it out makes reloads near-instant again.
The error:
The text was updated successfully, but these errors were encountered: