↧
Answer by Will Ness for Infinite type error when defining zip with foldr...
Applying the insight from my other answer, I was able to solve it, by defining two mutually-recursive types:-- tr ~ tq -> [(a,b)]-- tq ~ a -> tr -> [(a,b)]newtype Tr a b = R { runR :: Tq a b...
View ArticleAnswer by András Kovács for Infinite type error when defining zip with foldr...
My issue with using Fix to type zipp (as I pointed out in the comments to Carsten's answer to the prior question) is that no total language contains the Fix type:newtype Fix a = Fix { unFix :: Fix a...
View ArticleInfinite type error when defining zip with foldr only; can it be fixed?
(for the context to this see this recent SO entry).I tried to come up with the definition of zip using foldr only:zipp :: [a] -> [b] -> [(a,b)]zipp xs ys = zip1 xs (zip2 ys) where -- zip1 :: [a]...
View Article