Generics parameter syntax
Generics parameter syntax
Posted Jul 5, 2020 10:06 UTC (Sun) by dezgeg (subscriber, #92243)In reply to: Generics parameter syntax by davecb
Parent article: Generics for Go
Posted Jul 5, 2020 19:11 UTC (Sun)
by Cyberax (✭ supporter ✭, #52523)
[Link]
Posted Jul 5, 2020 22:23 UTC (Sun)
by dtlin (subscriber, #36537)
[Link] (2 responses)
In Haskell, types do begin with an upper-case letter or : symbol, but data constructors (which are values) also begin with an upper-case letter or : symbol and type variables begin with a lower-case letter or non-: symbol, so that's not useful for disambiguation.
But only values appear to the left of :: and only types appear to the right of ::, so there's no confusion. Except in import lists, or when -XTypeApplications, -XDataKinds, -XStarIsType, … No angle brackets so it doesn't suffer from C++'s problems though.
Posted Jul 6, 2020 20:38 UTC (Mon)
by dezgeg (subscriber, #92243)
[Link] (1 responses)
Posted Jul 7, 2020 12:19 UTC (Tue)
by dtlin (subscriber, #36537)
[Link]
Generics parameter syntax
Generics parameter syntax
Generics parameter syntax
It helps for that case, but if you have higher-order kinds, f<t> is also a type, for some appropriate type variables f and t.
Generics parameter syntax