In the Haskell syntax, we type as a (abstract) type of [a -> gt; B]
, which is a list for A's works, it will have a solid type of [int -> gt; Int]
, such as map (*) [1..10]
. What
You can not do this with a plain list, but you can type your own list-like type Can create:
{- # LANGUAGE GADTs # -} Data cascading list io where id :: Cascading list Ii Cascade :: (b -> o) - & gt; Cascading List I B - & gt; You can create these CascadingList
s as follows: addOnePositive :: CascadingList Int Bool addOnePositive = Cascade () & Gt; 0) $ Cascade (+1) $ Id
You can 'summarize' lists:
collapse :: cascading list ab - & gt; ; A - & gt; B fall id = id fall (waterfall fc) = f. Fall c
Then you
collapse addOnePositive 0 == true
note that it does not take Keeping in mind the types of intermediate tasks, it can not be what you want.
I just realized that this is an easy change to make some [c -> d, b -> c, a -> b] close to your intentions; I can edit it but I think you get this idea.
Comments
Post a Comment