UTF8 IO wrapper

A tiny UTF8 wrapper around basic IOs and REs for Panda:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
-- u2b: utf8 string to byte string
-- b2u: the reverse

split x y = MPS.split (x.u2b) (y.u2b) .map b2u
gsub x y z = MPS.gsub (x.u2b) (y.u2b) (z.u2b) .b2u
match x y = MPS.match (x.u2b) (y.u2b)

read_file = readFile
write_file = writeFile
ls x = MPS.ls (x.u2b) ^ map b2u
mkdir_p = u2b >>> createDirectoryIfMissing True

file_exist = u2b >>> doesFileExist
dir_exist = u2b >>> doesDirectoryExist

Beats Python 3.0, yeah :)

blog comments powered by Disqus