Provide coercions between OsString and WindowsString / PosixString
Bodigrim opened this issue · comments
ˌbodʲɪˈɡrʲim commented
It would be nice to have something like
import Data.Type.Coercion
coercionToPosixString :: Maybe (Coercion OsString PosixString)
#if defined(mingw32_HOST_OS)
coercionToPosixString = Nothing
#else
coercionToPosixString = Just Coercion
#endif
and same for coercionToWindowsString :: Maybe (Coercion OsString WindowsString)
Names are inspired by aeson
: coercionToHashMap
and coercionToMap
.
ˌbodʲɪˈɡrʲim commented
And same for OsChar
/ PosixChar
/ WindowsChar
.
ˌbodʲɪˈɡrʲim commented
Even better would be to provide both coercions at the same time:
coercionToPosix :: Maybe (Coercion OsChar OsString, Coercion OsString PosixString)
coercionToWindows :: Maybe (Coercion OsChar WindowsString, Coercion OsString WindowsString)
Julian Ospald commented
What exactly are the semantics? Do we encode/decode? Is that really coercion?
Julian Ospald commented
So coercion from OsString to PosixString just fails on windows?
I'm not too familiar with that mechanism.
Julian Ospald commented
Can you provide a PR?