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

Could not deduce (Pack a) arising from a use of `ffi' #1

Open
darthdeus opened this issue Jun 23, 2014 · 3 comments
Open

Could not deduce (Pack a) arising from a use of `ffi' #1

darthdeus opened this issue Jun 23, 2014 · 3 comments

Comments

@darthdeus
Copy link

I've done clean install of GHC 7.6.3, compiled the latest version of haste, cloned shade, ran haste-inst install in shade-core, which ran successfully. But then I tried to run it inside ``shade-haste` and I get the following error.

$ haste-inst install
Resolving dependencies...
Configuring shade-haste-0.1.0.0...
Building shade-haste-0.1.0.0...
Preprocessing library shade-haste-0.1.0.0...

src/Shade/Haste/Internal/React.hs:156:32:
    Could not deduce (Pack a) arising from a use of `ffi'
    from the context (Unpack a, Pack b)
      bound by the type signature for
                 fieldIn :: (Unpack a, Pack b) => String -> a -> b
      at src/Shade/Haste/Internal/React.hs:155:12-49
    Possible fix:
      add (Pack a) to the context of
        the type signature for
          fieldIn :: (Unpack a, Pack b) => String -> a -> b
    In the second argument of `(.)', namely
      `(ffi (toJSStr (fieldIn' f)))'
    In the expression: unsafePerformIO . (ffi (toJSStr (fieldIn' f)))
    In an equation for `fieldIn':
        fieldIn f
          = unsafePerformIO . (ffi (toJSStr (fieldIn' f)))
          where
              fieldIn' f = "(function(u){return u." ++ f ++ ";})"
Failed to install shade-haste-0.1.0.0
cabal: Error: some packages failed to install:
shade-haste-0.1.0.0 failed during the building phase. The exception was:
ExitFailure 1
@takeoutweight
Copy link
Owner

Hmm! I just tried 7.6.3 on a clean Ubuntu VM with the latest Haste and everything seemed to work. I'm not entirely sure what could be the issue here... Is there any way you have old leftover haste binaries or libraries left over from a previous install?

@katyo
Copy link

katyo commented Aug 3, 2014

I also get same error:

kayo@ikki:~/shade/shade-haste$ haste-inst install
Resolving dependencies...
Configuring shade-haste-0.1.0.0...
Building shade-haste-0.1.0.0...
Preprocessing library shade-haste-0.1.0.0...

src/Shade/Haste/Internal/React.hs:158:32:
    Could not deduce (Pack a) arising from a use of `ffi'
    from the context (Unpack a, Pack b)
      bound by the type signature for
                 fieldIn :: (Unpack a, Pack b) => String -> a -> b
      at src/Shade/Haste/Internal/React.hs:157:12-49
    Possible fix:
      add (Pack a) to the context of
        the type signature for
          fieldIn :: (Unpack a, Pack b) => String -> a -> b
    In the second argument of `(.)', namely
      `(ffi (toJSStr (fieldIn' f)))'
    In the expression: unsafePerformIO . (ffi (toJSStr (fieldIn' f)))
    In an equation for `fieldIn':
        fieldIn f
          = unsafePerformIO . (ffi (toJSStr (fieldIn' f)))
          where
              fieldIn' f = "(function(u){return u." ++ f ++ ";})"
Failed to install shade-haste-0.1.0.0
cabal: Error: some packages failed to install:
shade-haste-0.1.0.0 failed during the building phase. The exception was:
ExitFailure 1

My env:

kayo@ikki:~$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.6.3
kayo@ikki:~$ hastec --version
0.3

@katyo
Copy link

katyo commented Aug 3, 2014

I changed fieldIn function signature as GHC suggests:

fieldIn :: (Pack a, Unpack a, Pack b, Unpack b) => String -> a -> b

It works fine for me.
I also test todo example from here https://github.com/takeoutweight/shade-todomvc It works too.

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

3 participants