NeoHaskell
NeoHaskell copied to clipboard
Implement writeTextHandler function in File.hs
trafficstars
The writeTextHandler function in File.hs is currently not implemented. Please ensure that it is implemented correctly and follows best practices.
Suggested implementation:
writeTextHandler :: (Unknown.Convertible msg) => WriteTextOptions msg -> IO msg
writeTextHandler options = do
result <- options.path |> Path.toLinkedList |> TIO.writeFile options.text |> Exception.try @Exception.IOError
case result of
Either.Left _ -> pure (options.onError NotWritable)
Either.Right _ -> pure options.onSuccess
For more details, refer to the PR: https://github.com/neohaskell/NeoHaskell/pull/82 and the comment: https://github.com/neohaskell/NeoHaskell/pull/82#discussion_r1693458450