Strip control codes and extended characters from a string: Difference between revisions

→‎{{header|Haskell}}: Reduced the expression in terms of a liftA2 composition over two other functions.
(→‎{{header|OCaml}}: updated for recent ocaml versions with new type bytes)
(→‎{{header|Haskell}}: Reduced the expression in terms of a liftA2 composition over two other functions.)
Line 876:
 
=={{header|Haskell}}==
<lang Haskell>stripimport ::Control.Applicative String -> String(liftA2)
 
strip =
strip :: String -> String
filter
strip = filter (liftA2 (&&) (> 31) (< 126) . fromEnum)
(\x -- Though use of Data.Char functions like isAlpha, isDigit etc
-- seems more probable.
->
let o = fromEnum x
in o > 31 && o < 126)
 
main :: IO ()
9,659

edits