Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Doc] simple.hs doesn't compile (calls addWatch with FilePath instead of RawFilePath) #30

Open
dwhughes opened this issue Nov 9, 2019 · 0 comments

Comments

@dwhughes
Copy link

dwhughes commented Nov 9, 2019

Haskell newbie here, please expect naivety.

Using Ubuntu 19.10 x86_64. Beware: it's unclear to me whether getHomeDirectory :: IO RawFilePath is available anywhere in the standard Ubuntu distro (despite 45 minutes' effort), so applying the "correct" fix might make this example harder to use.

I made it work by (encodeUtf8 $ pack home) but of course that's a broken approach.

% ghc --version
The Glorious Glasgow Haskell Compilation System, version 8.6.5
% ghc simple.hs
[1 of 1] Compiling Main             ( simple.hs, simple.o )

simple.hs:13:60: error:
    • Couldn't match type ‘[Char]’
                     with ‘Data.ByteString.Internal.ByteString’
      Expected type: System.Posix.ByteString.FilePath.RawFilePath
        Actual type: FilePath
    • In the third argument of ‘addWatch’, namely ‘home’
      In a stmt of a 'do' block:
        wd <- addWatch
                inotify [Open, Close, Access, Modify, ....] home print
      In the expression:
        do inotify <- initINotify
           print inotify
           home <- getHomeDirectory
           wd <- addWatch inotify [Open, Close, ....] home print
           ....
   |
13 |     wd <- addWatch inotify [Open,Close,Access,Modify,Move] home print
   |                                                            ^^^^
mb720 added a commit to mb720/hinotify that referenced this issue Mar 9, 2020
addWatch expects a RawFilePath, which is an alias for a ByteString.
This issue was brought up here: kolmodin#30
@mb720 mb720 mentioned this issue Mar 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant