Snippet saved on:
1/30/2024, 6:23:32 AM (raw)
1/30/2024, 6:23:32 AM (raw)
allListsOfN::Int->a->a
allListsOfN n xs = foldr (\ l r -> (:) <$> l <*> r) [[]] (replicate n xs)
allListsOfN3::EnumaBoundeda=>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]]))
GHC output
Errors
Output