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