You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-- Old codetypeM=CheckingFuelMonad (SimpleUniqueMonad)
run::LabelMapMa->I.M (IdLabelMap, a)
run (LabelMapM f) = f M.empty -- >>= pure -- . snd-- new code (not correct yet i guess)run::EffCheckingFuel:>es=>EffUnique:>es=>LabelMapMa->Effes (IdLabelMap, a)
run (LabelMapM f) =pure$ f M.empty
{-# LANGUAGE DatatypeContexts #-}
dataEffUnique:>es=>LabelMapMaes=LabelMapM (IdLabelMap->Effes (IdLabelMap, a))
I got the following comment from someone else:
Usually you don't want to use DatatypeContexts, because they don't do what you expect or want. Which is why they were removed/hidden behind an extension (they were in Haskell98). Tthe main problem with them is they only apply when making values; they are not available when using those values. That requires an instance dictionary to carry around the proof of the constraint
Also this GHC warning
-XDatatypeContexts is deprecated: It was widely considered a misfeature, and has been removed from the Haskell language.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I'm trying to translate this
Newly made code (for context)
M
no longer used monadThe data type in question
Missing the constraint on
es
. Tried the followingI got the following comment from someone else:
Also this GHC warning
What is the right approach to model this?
Beta Was this translation helpful? Give feedback.
All reactions