To add, t is typically some kind of container although it doesn’t have to be. For instance, “t a” could be a “list (of) cat(s)”, except it doesn’t *have* to be a list (can be anything that’s an instance of Foldable), and it doesn’t *have* to be cats (could be a giraffe or a piano or any other type). In “list (of) cat(s)”, list can be thought of as a type-level function that takes a type (cat) to construct a concrete type (list cat), hence the notation. This shows you commonly defined instances of Foldable (notice that the very first one is a list, denoted by [ ]). https://hackage.haskell.org/package/Cabal-3.4.0.0/docs/Distribution-Compat-P... — RRI On Tue, Aug 3, 2021 at 18:06 Francesco Ariis <fa-ml@ariis.it> wrote:
Il 03 agosto 2021 alle 19:36 Galaxy Being ha scritto:
Thanks for the insights. So what then does the t a part mean? In the simpler version t a is [a]. Is t some container? It's not meant to be a function, is it?
`t` is any unary type constructor. Maybe, Tree, etc. all take one parameter (Maybe a, Tree a, etc.); in a similar fashion [] takes one parameter ([] a). [a] is just syntactic sugar
λ> [7] :: [Int] [7] λ> [7] :: [] Int [7]
_______________________________________________ Beginners mailing list Beginners@haskell.org http://mail.haskell.org/cgi-bin/mailman/listinfo/beginners
-- -- Ramnath R Iyer