With haskell's turtle library, how to extract filename from FilePath? -
when using takefilename type error:
:t v print v :t takefilename takefilename v v :: filepath filepath "/media/miguel/backup/backups" takefilename :: filepath -> filepath couldn't match type ‘turtle.filepath’ ‘string’ expected type: ihaskellsysio.filepath actual type: turtle.filepath in first argument of ‘takefilename’, namely ‘v’ in expression: takefilename v
is because turtle's filepath different prelude's filepath ?
turtle still uses system-filepath
has customized "filepath" type can find here. many other haskell libraries use filepath library defines filepath
synonym string
(type filepath = string). case here ihaskell
.
so yes both filepath types mismatch. note can convert turtle.filepath
string
using show
(because type has show instance). can convert text
using fp
turtle.format module.
system-filepath
deprecated. there issue this. please read: https://github.com/gabriel439/haskell-turtle-library/issues/54
hope helps.
Comments
Post a Comment