I need to print the elements in a powerset. Right now my code's output is this:
"a"
"ab"
"b"
"x"
"xy"
"xyz"
"xz"
"y"
"yz"
"z"
However, I need the output to not have quotation marks, like this:
a
ab
b
x
xy
xyz
xz
y
yz
z
This is what I have. How do I fix it do to get the right output?
import Data.List
powerset = foldr (\x acc -> acc ++ map (x:) acc) [[]]
main = do
numCases <- getLine
repl $ (read numCases :: Int)
repl num = do
if(num == 0) then return ()
else do
size <- getLine
input <- getLine
let ret = tail $ sort $ powerset input
mapM (\x -> print x) ret
repl $ num-1