If you want to expand a ~
like the shell does, you can define a function
expandHome :: FilePath -> FilePath -> FilePath
expandHome home ('~':xs) = home ++ xs
expandHome home path = path
This can be called as
λ> h <- getHomeDirectory
λ> expandHome h "~/temp"
"/home/kqr/temp"