allListsOfN :: Int -> [a] -> [[a]] allListsOfN n xs = foldr (\ l r -> (:) <$> l <*> r) [[]] (replicate n xs) allListsOfN2 :: (Enum a, Bounded a) => Int -> a -> [[a]] allListsOfN2 n _ = allListsOfN n xs where xs = enumFromTo minBound maxBound main = do putStrLn (show (allListsOfN 3 [False, True])) putStrLn (show (allListsOfN2 3 True))