System.IO.UTF8 not found (installing PureScript) - haskell

I'm trying to install PureScript on Ubuntu 14.04. I have the latest version of Haskell-Platform and have run cabal update. During cabal install purescript I get an error saying that the module System.IO.UTF8 is not found. Googling reveals that this is part of utf8-string and should be one of the exposed modules when that package is installed.
However, when I install it, no such package is available:
ely#eschaton:~$ cabal update
Downloading the latest package list from hackage.haskell.org
ely#eschaton:~$ cabal --reinstall install utf8-string
Resolving dependencies...
In order, the following will be installed:
utf8-string-1 (reinstall)
Warning: Note that reinstalls are always dangerous. Continuing anyway...
Configuring utf8-string-1...
Building utf8-string-1...
Preprocessing library utf8-string-1...
[1 of 5] Compiling Codec.Binary.UTF8.String ( Codec/Binary/UTF8/String.hs, dist/build/Codec/Binary/UTF8/String.o )
[2 of 5] Compiling Codec.Binary.UTF8.Generic ( Codec/Binary/UTF8/Generic.hs, dist/build/Codec/Binary/UTF8/Generic.o )
[3 of 5] Compiling Data.String.UTF8 ( Data/String/UTF8.hs, dist/build/Data/String/UTF8.o )
[4 of 5] Compiling Data.ByteString.UTF8 ( Data/ByteString/UTF8.hs, dist/build/Data/ByteString/UTF8.o )
[5 of 5] Compiling Data.ByteString.Lazy.UTF8 ( Data/ByteString/Lazy/UTF8.hs, dist/build/Data/ByteString/Lazy/UTF8.o )
In-place registering utf8-string-1...
Installing library in /home/ely/.cabal/lib/utf8-string-1/ghc-7.6.3
Registering utf8-string-1...
Installed utf8-string-1
ely#eschaton:~$ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> import System.IO.UTF8
<no location info>:
Could not find module `System.IO.UTF8'
It is not a module in the current program, or in any known package.
You can see that only 5 of the stated proposed libraries are compiled.
The PureScript source definitely makes use of System.IO.UTF8.
But System.IO.UTF8 looks like a pretty old package that has not undergone changes in a long time (2+ years), so it's unlikely that this was a significant change in a recent version. To boot, PureScript is very new, and so would surely be based on newer versions of utf8-string if they were available.
So the question is: why isn't PureScript able to install this dependency on its own ... and why does the cabal installation of utf8-string fail to expose the System.IO.UTF8 module as it suggests it should.

Looks like utf-string was updated today (Jan 23) to version 1 which doesn't have System.IO.UTF8 module anymore. That one is present in previous version 0.3.8 of utf-string.
And the purescript doesn't specify the upper bound for utf-string.
EDIT I made a PR to workaround the issue.
There is more proper fix WIP too.

Related

Haskell package installed but not found (Ubuntu) [duplicate]

I installed diagrams, and it seems to be there, but GHCi doesn’t find it. I tried adding the local sandbox to the command line (-package-db), but still no luck.
Any suggestions?
C:\Users\guthrie>
C:\Users\guthrie>cabal install diagrams
Resolving dependencies...
All the requested packages are already installed:
diagrams-1.2
Use --reinstall if you want to reinstall anyway.
I find it in:
C:\Users\guthrie\.cabal-sandbox\i386-windows-ghc-7.6.3-packages.conf.d
(diagrams-1.2, diagrams-contrib, -core, -lib, -svg)
But running: “cabal repl” or using the GHC(i) flag “-package-db=…”
fail to find it:
C:\Users\guthrie>cabal repl
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :m + Diagrams.Prelude
<no location info>:
Could not find module `Diagrams.Prelude'
It is not a module in the current program, or in any known package.
Prelude>
To clarify; ignoring the cabal invocations, using GHC/i directly, and the program diagramsDemo.hs:
-- http://projects.haskell.org/diagrams/doc/quickstart.html
--
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
main = mainWith (circle 1 :: Diagram B R2)
Gives:
C:\Users\guthrie\Desktop\xFer\Graphics>ghc --make diagramsDemo.hs
diagramsDemo.hs:7:8:
Could not find module `Diagrams.Backend.SVG.CmdLine'
Use -v to see a list of the files searched for.
C:\Users\guthrie\Desktop\xFer\Graphics>ghc --make diagramsDemo.hs -package-db=C:\Users\guthrie\.cabal-sandbox\i386-windows-ghc-7.6.3-packages.conf.d
diagramsDemo.hs:7:8:
Could not find module `Diagrams.Backend.SVG.CmdLine'
Use -v to see a list of the files searched for.
As bheklilr said, if ghci is started with cabal repl, it will only find packages specified as a dependency in the .cabal file.
However you can start it with cabal exec ghci, then it will find all packages installed in the sandbox.
The same is true for invoking ghc (cabal build vs. cabal exec ghc), but note that if you want to pass flags you have to use --, like in cabal exec ghc -- -O2 Main.hs. Alternatively you can use cabal exec bash and launch ghci or ghc in the new shell.
cabal exec was added with Cabal 1.20.

Cabal fails to install dependencies, but can install them if asked directly

I've seen a very strange recurring problem with Cabal that's interfering with my ability to get repeatable Haskell builds. I have a cabal project with a sandbox. If I do cabal install, I get errors of the form
Y failed during the building phase. The exception was:
ExitFailure 1
X depends on Y which failed to install.
where X is a direct dependency of my project and Y is some transitive dependency. However, if I just type cabal install X, then it works!
Here's a specific example: my project depends on the interpolate package. When I do cabal install --allow-newer, I get errors like this:
Resolving dependencies...
Configuring haskell-src-meta-0.6.0.9...
Building haskell-src-meta-0.6.0.9...
Preprocessing library haskell-src-meta-0.6.0.9...
[1 of 6] Compiling Language.Haskell.TH.Instances.Lift ( src/Language/Haskell/TH/Instances/Lift.hs, dist/dist-sandbox-d2861272/build/Language/Haskell/TH/Instances/Lift.o )
[2 of 6] Compiling Language.Haskell.Meta.Syntax.Translate ( src/Language/Haskell/Meta/Syntax/Translate.hs, dist/dist-sandbox-d2861272/build/Language/Haskell/Meta/Syntax/Translate.o )
[3 of 6] Compiling Language.Haskell.Meta.Parse ( src/Language/Haskell/Meta/Parse.hs, dist/dist-sandbox-d2861272/build/Language/Haskell/Meta/Parse.o )
[4 of 6] Compiling Language.Haskell.Meta.Parse.Careful ( src/Language/Haskell/Meta/Parse/Careful.hs, dist/dist-sandbox-d2861272/build/Language/Haskell/Meta/Parse/Careful.o )
[5 of 6] Compiling Language.Haskell.Meta ( src/Language/Haskell/Meta.hs, dist/dist-sandbox-d2861272/build/Language/Haskell/Meta.o )
[6 of 6] Compiling Language.Haskell.Meta.Utils ( src/Language/Haskell/Meta/Utils.hs, dist/dist-sandbox-d2861272/build/Language/Haskell/Meta/Utils.o )
src/Language/Haskell/Meta/Utils.hs:67:1:
Duplicate instance declarations:
instance Typeable Q
-- Defined at src/Language/Haskell/Meta/Utils.hs:67:1
instance Typeable Q -- Defined in ‘Language.Haskell.TH.Instances’
src/Language/Haskell/Meta/Utils.hs:71:1:
Duplicate instance declarations:
instance Typeable QuasiQuoter
-- Defined at src/Language/Haskell/Meta/Utils.hs:71:1
instance Typeable QuasiQuoter
-- Defined in ‘Language.Haskell.TH.Instances’
Failed to install haskell-src-meta-0.6.0.9
...
haskell-src-meta-0.6.0.9 failed during the building phase. The exception was:
ExitFailure 1
interpolate-0.1.0 depends on haskell-src-meta-0.6.0.9 which failed to install.
However, if I proceed to type cabal install interpolate-0.1.0, the installation succeeds and I'm able to keep installing my project.
This is frustrating because I have to "manually" install several packages before I can get all my dependencies installed. The fact that the original installations fail with compiler errors seems to suggest that the compiler is configured differently somehow?
I'm using GHC 7.8.3 and cabal-install 1.22.4.0 (version 1.22.3.0 of the Cabal library). Many thanks for any help!
Actually it's not a problem with the version of haskell-src-meta but rather with the version of its dependency th-orphans.
haskell-src-meta (versions 0.6.0.8 and 0.6.0.9) has an upper bound th-orphans <0.12.
With --allow-newer you told Cabal to ignore version upper bounds, so Cabal decided to use th-orphans version 0.12.0, since it's newer and presumably better. But, in fact, haskell-src-meta really does not build with th-orphans version 0.12.0, as you found out.
Unrestricted use of --allow-newer is likely to run into this kind of problem in general. It's better to specify the packages whose upper bounds you want to ignore with --allow-newer=base,containers,..., though in some cases doing so can be rather tedious.
In the first sentence of your question you mentioned repeatable builds. If that is what you want, there is no substitute for simply recording the exact versions that you want of all of your direct and indirect dependencies.

Haskell package installed but not found

I installed diagrams, and it seems to be there, but GHCi doesn’t find it. I tried adding the local sandbox to the command line (-package-db), but still no luck.
Any suggestions?
C:\Users\guthrie>
C:\Users\guthrie>cabal install diagrams
Resolving dependencies...
All the requested packages are already installed:
diagrams-1.2
Use --reinstall if you want to reinstall anyway.
I find it in:
C:\Users\guthrie\.cabal-sandbox\i386-windows-ghc-7.6.3-packages.conf.d
(diagrams-1.2, diagrams-contrib, -core, -lib, -svg)
But running: “cabal repl” or using the GHC(i) flag “-package-db=…”
fail to find it:
C:\Users\guthrie>cabal repl
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> :m + Diagrams.Prelude
<no location info>:
Could not find module `Diagrams.Prelude'
It is not a module in the current program, or in any known package.
Prelude>
To clarify; ignoring the cabal invocations, using GHC/i directly, and the program diagramsDemo.hs:
-- http://projects.haskell.org/diagrams/doc/quickstart.html
--
import Diagrams.Prelude
import Diagrams.Backend.SVG.CmdLine
main = mainWith (circle 1 :: Diagram B R2)
Gives:
C:\Users\guthrie\Desktop\xFer\Graphics>ghc --make diagramsDemo.hs
diagramsDemo.hs:7:8:
Could not find module `Diagrams.Backend.SVG.CmdLine'
Use -v to see a list of the files searched for.
C:\Users\guthrie\Desktop\xFer\Graphics>ghc --make diagramsDemo.hs -package-db=C:\Users\guthrie\.cabal-sandbox\i386-windows-ghc-7.6.3-packages.conf.d
diagramsDemo.hs:7:8:
Could not find module `Diagrams.Backend.SVG.CmdLine'
Use -v to see a list of the files searched for.
As bheklilr said, if ghci is started with cabal repl, it will only find packages specified as a dependency in the .cabal file.
However you can start it with cabal exec ghci, then it will find all packages installed in the sandbox.
The same is true for invoking ghc (cabal build vs. cabal exec ghc), but note that if you want to pass flags you have to use --, like in cabal exec ghc -- -O2 Main.hs. Alternatively you can use cabal exec bash and launch ghci or ghc in the new shell.
cabal exec was added with Cabal 1.20.

c2hs installation error with Mac OS X 10.7.5

I'm trying to install c2hs with cabal install c2hs.
I created ~/.cabal/bin to install the binary beforehand.
With the command cabal install c2hs to get the errors.
src/Control/StateTrans.hs:77:1: Warning:
Module `Prelude' does not export `catch'
[ 3 of 26] Compiling Data.Errors ( src/Data/Errors.hs, dist/build/c2hs/c2hs-tmp/Data/Errors.o )
[ 4 of 26] Compiling Data.Attributes ( src/Data/Attributes.hs, dist/build/c2hs/c2hs-tmp/Data/Attributes.o )
[ 5 of 26] Compiling Text.Lexers ( src/Text/Lexers.hs, dist/build/c2hs/c2hs-tmp/Text/Lexers.o )
[ 6 of 26] Compiling Control.StateBase ( src/Control/StateBase.hs, dist/build/c2hs/c2hs-tmp/Control/StateBase.o )
[ 7 of 26] Compiling Data.NameSpaces ( src/Data/NameSpaces.hs, dist/build/c2hs/c2hs-tmp/Data/NameSpaces.o )
[ 8 of 26] Compiling C2HS.C.Attrs ( src/C2HS/C/Attrs.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Attrs.o )
[ 9 of 26] Compiling C2HS.C.Builtin ( src/C2HS/C/Builtin.hs, dist/build/c2hs/c2hs-tmp/C2HS/C/Builtin.o )
[10 of 26] Compiling Paths_c2hs ( dist/build/autogen/Paths_c2hs.hs, dist/build/c2hs/c2hs-tmp/Paths_c2hs.o )
dist/build/autogen/Paths_c2hs.hs:21:13: Not in scope: `catch'
dist/build/autogen/Paths_c2hs.hs:22:13: Not in scope: `catch'
dist/build/autogen/Paths_c2hs.hs:23:14: Not in scope: `catch'
dist/build/autogen/Paths_c2hs.hs:24:17: Not in scope: `catch'
cabal: Error: some packages failed to install:
c2hs-0.16.5 failed during the building phase. The exception was:
ExitFailure 1
What is wrong with the installation? The ghc version is 7.6.3.
The install worked for me right now, on my Ubuntu box, so I can say for sure that c2hs isn't broken for everyone right now.
I think you might have version issues.... Try
cabal update
and try the install again.
In particular-
The function Prelude.catch was moved to Control.Exception.catch recently, see https://ghc.haskell.org/trac/ghc/ticket/4865. I downloaded the c2hs sources (using cabal unpack c2hs), and looked at what headers Paths_c2hs.hs needs (this seems to be the file with the import problems). This is what the imports section contained-
import qualified Control.Exception as Exception
import Data.Version (Version(..))
import System.Environment (getEnv)
import Prelude
(Paths_c2hs.hs is autogenerated, so I had to build it first).
Indeed, it was using Control.Exception. Because this is a module in base, you should have it, and probably just have out of date/mismatched packages. (In fact, my file's line numbers don't match your error message line numbers above- This is another indication we are using different versions, and I believe mine is up to date :) .)
Although I think that the "cabal update" will fix the problem, if not, try looking in these two places-
Does Control.Exception.catch exist in your base modules? Just try to compile an empty program with an dummy reference to catch, like this-
import Control.Exception
x = catch
main = undefined
Does your autogenerated Paths_c2hs.hs point to the correct catch function. Just use cabal to unpack, configure and build c2hs and then look at dist/build/autogen/Paths_c2hs.hs. (you will probably hit your error in the build phase, but given what you have shown above, it will happen after the Paths_c2hs.hs creation).
The issue was that I installed two different versions of ghc on my mac: one from brew install ghc and the other from haskell platform.
I had to install the newest version of haskell platform, but before doing that I also needed to uninstall old version uninstall-hs only VERSION and brew unistall ghc.
After reinstalling the newest haskell platform, the compilation works fine.
https://github.com/haskell/cabal/issues/1137
How to install Haskell cabal tool for Haskell 7.6.1 on Mac OSX?
Other method can be using brew brew install haskell-platform.

GUI programming in Haskell - installation problems on Ubuntu

is there a GUI package that is still up-to-date?
I tried installing both wxHaskell and gtk2hs today and both fail on dependencies I just cannot solve (wxHaskell cannot find some wxWidget libs and while trying the glade tutorial gtk2hs fails on a missing pkg-config libglade2-0 I installed too).
I guess it's just some problem with me not understanding the linux/cabal/package install things good enough but is there a up-to-date tutorial how to get started (install) some GUI lib for Haskell somewhere around?
Here are the errors:
carsten#Carsten-VirtualBox:~$ cabal install glade
Resolving dependencies...
[1 of 2] Compiling SetupWrapper ( /tmp/glade-0.12.1-12934/glade-0.12.1/SetupWrapper.hs, /tmp/glade-0.12.1-12934/glade-0.12.1/dist/setup/SetupWrapper.o )
[2 of 2] Compiling Main ( /tmp/glade-0.12.1-12934/glade-0.12.1/Setup.hs, /tmp/glade-0.12.1-12934/glade-0.12.1/dist/setup/Main.o )
Linking /tmp/glade-0.12.1-12934/glade-0.12.1/dist/setup/setup ...
[1 of 2] Compiling Gtk2HsSetup ( Gtk2HsSetup.hs, dist/setup-wrapper/Gtk2HsSetup.o )
[2 of 2] Compiling Main ( SetupMain.hs, dist/setup-wrapper/Main.o )
Linking dist/setup-wrapper/setup ...
Configuring glade-0.12.1...
setup: The pkg-config package libglade-2.0 version >=2.0.0 is required but it
could not be found.
cabal: Error: some packages failed to install:
glade-0.12.1 failed during the configure step. The exception was:
ExitFailure 1
and
carsten#Carsten-VirtualBox:~$ cabal install wxc
Resolving dependencies...
[1 of 1] Compiling Main ( /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/Setup.hs, /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/dist/setup/Main.o )
Linking /tmp/wxc-0.90.0.4-13078/wxc-0.90.0.4/dist/setup/setup ...
Configuring wxc-0.90.0.4...
Warning: No config found to match: /usr/bin/wx-config --version=2.9 --version-full
in /usr/lib/x86_64-linux-gnu/wx/config
If you require this configuration, please install the desired
library build. If this is part of an automated configuration
test and no other errors occur, you may safely ignore it.
You may use wx-config --list to see all configs available in
the default prefix.
setup: failed
cabal: Error: some packages failed to install:
wxc-0.90.0.4 failed during the configure step. The exception was:
ExitFailure 1
This is really frustrating me - maybe someone can help me here - thank you!
I am running 12.04 and everything works fine for me.
Are you sure you have libglade2-dev installed ? That should fix it.
Coming from ArchLinux i had the same problem at first when i didn't know there were separate dev libraries, i don't remember having to do this in arch.

Resources