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
"The implementation actually creates a key, but because the key cannot escape the given function f, there is no way to observe that if we run withKey f twice, that it will get a different key the second time."
But in the following we see it is possible.
Nick
{-#LANGUAGE ExistentialQuantification, RankNTypes #-}
moduleMain(main) whereimportData.HMapasHMapdataWrapped=forallx.Wrapped (HKeyx())
create::()->Wrapped
create ()=HMap.withKey Wrappedx,y,z::Wrapped
x = create ()
y = create ()
z = y
comp::Wrapped->Wrapped->Bool
comp (Wrapped key1) (Wrapped key2) =HMap.unique key1 ==HMap.unique key2
main::IO()
main =doprint ("x~y",comp x y)
print ("x~z",comp x z)
print ("y~z",comp y z)
{- Prints...("x~y",False)("x~z",False)("y~z",True)-}
The text was updated successfully, but these errors were encountered:
The doc for HKey.withKey states:
"The implementation actually creates a key, but because the key cannot escape the given function f, there is no way to observe that if we run withKey f twice, that it will get a different key the second time."
But in the following we see it is possible.
Nick
The text was updated successfully, but these errors were encountered: