how the (m a) of m (m a) can be represent a several containers for a data type

Submitted by metaperl on Fri, 04/14/2006 - 7:30pm.
this is more of a personal blog post than anything, so either you get it or you dont [18:10:44] palomer: but what does return do? [18:12:17] it takes a value of type b and returns a value of type (m b) [18:12:29] a value of type (m b) is a box with value of type b in it [18:14:49] palomer: but that's just my point: (m b) has _one_ element [18:15:12] therefore m (m a) is something where m has (m a) and (m a) has one element [18:18:55] "The third method, join, also specific to monads, takes a container of containers m (m a), and combines them into one m a in some sensible fashion." ---- why is this a container of containers instead of a container of one [18:21:55] @type [True, False, True] [18:21:57] [Bool] [18:22:07] @type [[True, False, True], [False, True]] [18:22:07] [[Bool]] [18:22:15] That's for metaperl . [18:23:39] monochrom: ah! the second one is m (m a) [18:23:55] YES! [18:36:15] return takes a single element and "containerizes it", yielding something of type m a... but that (m a) just so happens to be an (m a) where the container has one element. There is nothing about the notation (m a) which constrains (m a) to only contain one type as the input to join (as well as monochrom's example) shows