What is a way to implement similar functionality in Haskell of List comprehensions with guards in F#
for example:
factors :: Int -> [Int]
factors = [x | x <-[1 .. n], n 'mod' x == 0]
factors 15
[1,3,5,15]
and
posInt :: Int -> [Int]
posInt = [n | n > 0]
posInt 5
[5]
posInt 0
[]
gradbot is right. Faithfully converting
posIntwould look like: