wrap [1,2,3] should output [[1],[2],[3]]
wrap [[1],[2],[3]] should output [ [[1]], [[2]], [[3]] ]
my implementation is:
wrap [] = []
wrap (x:xs) = [x] : [wrap xs]
and haskell output an error: Occurs check: cannot construct the infinite type: t ~ [t]
Expected type: [t] -> [t] Actual type: [t] -> [[t]]
wrap (x:xs) = [x] : wrap xs
? – zerkmswrap = map pure
. – Ry-¯\_(ツ)_/¯
– zerkms