« first day (280 days earlier)      last day (100 days later) » 

5:20 PM
import Data.List (findIndices)

replace index new list = take index list ++ new ++ drop (index + 1) list
expand old new list = map (\index -> replace index new list) (findIndices (== old) list)

types' xs = xs ++ types' (xs >>= expand 'd' "(d -> d)")
types = types' ["d"]

printTypes n = putStr . unlines $ take n types
@RMartinhoFernandes I managed to enumerate my types in the parser :) Not practical, but certainly interesting:
d
(d -> d)
((d -> d) -> d)
(d -> (d -> d))
(((d -> d) -> d) -> d)
((d -> (d -> d)) -> d)
((d -> d) -> (d -> d))
((d -> d) -> (d -> d))
(d -> ((d -> d) -> d))
(d -> (d -> (d -> d)))
((((d -> d) -> d) -> d) -> d)
(((d -> (d -> d)) -> d) -> d)
(((d -> d) -> (d -> d)) -> d)
(((d -> d) -> d) -> (d -> d))
(((d -> d) -> (d -> d)) -> d)
((d -> ((d -> d) -> d)) -> d)
((d -> (d -> (d -> d))) -> d)
((d -> (d -> d)) -> (d -> d))
(((d -> d) -> d) -> (d -> d))
((d -> (d -> d)) -> (d -> d))
((d -> d) -> ((d -> d) -> d))
 
5:34 PM
Damnit, my algorithm produces duplicates like ((d -> d) -> (d -> d)) :(
quickfix:
types' xs = let xs' = nub xs in xs' ++ types' (xs' >>= expand 'd' "(d -> d)")
 

« first day (280 days earlier)      last day (100 days later) »