Re:Idris 2: Quantitative Type Theory in Practice
by 4ad on Thursday January 27, 2022 @09:20AM
(#30100846)
> I suppose the same is true in Haskell, but you don't write type constructors using '->' between the fields, so this punning is less obvious
That's exactly how you write GADTs in Haskell: https://downloads.haskell.org/~ghc/6.6/docs/html/users_guide....
The input parameters to the "functions" appear to be data elements from within the compressed list. Because that's what they are. But this wasn't obvious to me.
I think the weird bit is when the tags and fields within a datatype are represented using the same syntax as a function's name and parameters. This punning threw me off. I suppose the same is true in Haskell, but you don't write type constructors using '->' between the fields, so this punning is less obvious. (And Haskell's syntax for product types is itself less familiar to me than a 'struct' definition in a C-like language.)