I installed threepenny-gui by setting up a cabal sandbox and running
cabal install threepenny-gui -fbuildExamples
which seemed to work fine. The examples were found in the .cabal-sandbox/bin
-folder and they worked perfectly.
After that I looked at the source code of the examples and tried to run them using the runhaskell
and ghci
-scripts and got the following errors
>./runhaskell CRUD.hs
../src/Foreign/JavaScript/Marshal.hs:62:7: Warning:
In the use of ‘Data.Aeson.Encode.fromValue’
(imported from Data.Aeson.Encode):
Deprecated: "Use 'encodeToTextBuilder' instead"
../src/Graphics/UI/Threepenny/Core.hs:349:43:
Could not deduce (JS.FromJS a) arising from a use of ‘get’
from the context (ToJS a, FFI (JSFunction a))
bound by the type signature for
fromObjectProperty :: (ToJS a, FFI (JSFunction a)) =>
String -> Attr Element a
at ../src/Graphics/UI/Threepenny/Core.hs:348:23-78
Possible fix:
add (JS.FromJS a) to the context of
the type signature for
fromObjectProperty :: (ToJS a, FFI (JSFunction a)) =>
String -> Attr Element a
In the first argument of ‘mkReadWriteAttr’, namely ‘get’
In the expression: mkReadWriteAttr get set
In an equation for ‘fromObjectProperty’:
fromObjectProperty name
= mkReadWriteAttr get set
where
set v el = runFunction $ ffi ("%1." ++ name ++ " = %2") el v
get el = callFunction $ ffi ("%1." ++ name) el
with both of the scripts. I also tried running/compiling the sample program from http://hackage.haskell.org/package/threepenny-gui-0.6.0.1/docs/Graphics-UI-Threepenny.html which resulted in the following errors
> ghci test.hs
GHCi, version 7.8.4: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
test.hs:3:18:
Could not find module ‘Graphics.UI.Threepenny’
Use -v to see a list of the files searched for.
test.hs:4:25:
Could not find module ‘Graphics.UI.Threepenny.Core’
Use -v to see a list of the files searched for.
Failed, modules loaded: none.
My experience using external libraries with Haskell is very limited and the latter one clearly comes from ghc not knowing where to look for these packages.
How can I provide the right paths to ghc and get the Core.hs
to work properly?