Reduce dependence on the internal dictionary passing mechanism

Part of this work was done by @the-dr-lazy in
https://github.com/ajnsit/purescript-typeable/pull/3.

GOOD:
Now there is no more dependence on dictionaries being passed as function
arguments at runtime.

BAD:
1. However, we still depend on the dictionaries being stable at runtime.
2. We now also assume that the output of the new function `makeTag` will
never be cached.
This commit is contained in:
Anupam Jain
2023-07-06 20:10:22 +05:30
parent 3c428f76d6
commit f3dd0c0fb1
5 changed files with 70 additions and 109 deletions

View File

@@ -1,11 +1,12 @@
module Test.Person where
import Data.Typeable (class TagT, TypeRep, proxyT, typeRep)
import Data.Typeable (class Tagged, TypeRep, makeTag, typeRep)
import Data.Unit (unit)
newtype Person = Person { name :: String, location :: String }
instance tagTPerson :: TagT Person where
tagT = proxyT
instance taggedPerson :: Tagged Person where
tag = makeTag unit
typePerson :: TypeRep Person
typePerson = typeRep