as you know the foldl function is defined as :
foldl :: (a -> b -> a ) -> a -> [b] -> a
I want to rewrite the function as an uncurrified function
I tried this one:
foldl :: ( (a-> b-> a) , a , [b] ) -> a
Is that correct? Maybe it is not important to uncurry but I am gonna write an exam and I am pretty sure this will be one of the tasks to do.
Thanks in anticipation !
Well, that sure is an uncurried form of foldl
. However, there a more levels on which you can do this – what I'd can the "fully uncurried form" would be
foldl'' :: ( ((a,b) -> a), a, [b] ) -> a
where not just the function itself but also its function argument is uncurried. OTOH, just calling uncurry
on the function would yield merely
foldl''' :: ( (a->b->a), a ) -> [b] -> a
which might thus also be called "uncurried foldl
", though it would certainly not be the desired interpretation in an exam.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.