[Haskell-cafe] Re: Could not find module `Text.Regex'

2010-01-28 Thread Lee Houghton

On 29/01/2010 03:51, zaxis wrote:


import Text.Regex

date_by_ntday dateStr ntday = do
 let [y,m,d] = map (\x ->  read x::Int) $ splitRegex (mkRegex "-") dateStr
 

%ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.12.1

Which package(s) do i need to use Text.Regex ?

Sincerely!


It looks like you want regex-compat:

http://hackage.haskell.org/packages/archive/regex-compat/0.92/doc/html/Text-Regex.html

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Installing Haskell on Windows 7

2009-12-27 Thread Lee Houghton

On 27/12/2009 19:26, Thomas Hühn wrote:

Hi

Duncan Coutts  writes:


Except for haddock, none of these packages come with the Haskell
Platform. These are packages that you must have installed previously. So
ghc-pkg check is quite right to report them.


Okay, right.


Okay, reinstalling them all (with --user --reinstall").

Except haddock:

C:\Users\Thomas>cabal install haddock --user --reinstall
Resolving dependencies...
cabal: cannot configure haddock-2.6.0. It requires ghc>=6.12&&  <6.14
There is no available version of ghc that satisfies>=6.12&&  <6.14


Right, try installing the same version as you've got currently rather
than the latest version.

In an ideal world the cabal-install package dependency resolver would
work out that the latest version cannot be installed (since it needs a
later ghc) and fall back to the next version that can work. However at
the moment it is not quite that smart. Use:

cabal install haddock-2.4.2


"cabal install haddock-2.4.2 --user --reinstall" ends with:
Linking dist\build\haddock\haddock.exe ...
cabal: Error: some packages failed to install:
haddock-2.4.2 failed during the final install step. The exception was:
CreateDirectory: permission denied (Zugriff verweigert)


You can edit this config file. I suggest you change it to use per-user
installs by default. Set "user-install: True" (and make sure you
uncomment the line, the "--" prefix).


That doesn't work at all. As soon as I uncomment that line and set it
to True, I get:

cabal: C:\Users\Thomas\AppData\Roaming\cabal\packages
user-install: True\hackage.haskell.org\00-index.tar: openBinaryFile: invalid arg
ument (Invalid argument)


The most likely cause is that your "user-install: True" line is indented. 
Indentation is significant in the config file because it indicates layout for nested 
sections: remove any leading spaces on that line and that should do the trick.


But then again I shouldn't have to meddle with some installed
configuration file,


These defaults worked ok for Windows XP but they're clearly no good for
Vista and Win7. Just change the default to per-user installs.


especially since there has been no warning that I had to do that and
very especially since I entered my destination folder upon
installation. Maybe it's okay, but it kind of makes me nervous. And
God knows what else I haven't stumbled upon yet.


Where you install the Haskell Platform is independent of these settings.
You would not want to install other packages into the same location as
the platform and there's no particular reason to suppose that you would
have the file permissions to do so.


Not in the Platform directory itself, but I'd like to group bigger
chunks like "everything Haskell" in a common directory (with
subdirectories "Platform", "Local-Cabal", "whatever"), just as I put
TeX Live into its own directory, right under the root directory. Makes
PATHs shorter, as well.


No, it's reasonable to expect the defaults to work. Sadly they do not at
the moment for Windows 7. Change it to use per-user installs by default
and let us know how that goes.


No luck with haddoch, so far, and hakyll (which sounded cool and I
wanted to try out) doesn't work, either:

Linking dist\build\markdown2pdf\markdown2pdf.exe ...
Created man\man1\pandoc.1
Created man\man1\hsmarkdown.1
Created man\man1\html2markdown.1
Created man\man1\markdown2pdf.1
setup.exe: CreateDirectory: permission denied (Zugriff verweigert)
cabal: Error: some packages failed to install:
hakyll-0.2 depends on pandoc-1.3 which failed to install.
pandoc-1.3 failed during the final install step. The exception was:
exit: ExitFailure 1


I suspect this might be caused by 
http://hackage.haskell.org/trac/hackage/ticket/466. Here's what I have in my 
cabal config instead of the default:

install-dirs user
  -- prefix: C:\Users\Asztal\AppData\Roaming\cabal
  -- bindir: $prefix\bin
  -- libdir: $prefix
  -- libsubdir: $pkgid\$compiler
  -- libexecdir: $prefix\$pkgid
  -- datadir: "C:\\Program Files (x86)\\Haskell"
  datadir: $prefix\data
  -- datasubdir: $pkgid
  -- docdir: $prefix\doc\$pkgid
  -- htmldir: $docdir\html
  -- haddockdir: $htmldir

Using these settings haddock-2.4.2 and hakyll install fine for me. If I revert 
$datadir to the default, I get the same as you.


As I said before, I don't have a clue, where cabal wants to install
what. Some error messages beyond "failed" would have been nice. Like
"creating directory XYZ failed".

BTW, I just retried installing everything manually (GHC 6.12.1) and I
almost got there, but the network package doesn't install. Probably
because I don't have a full mingw installation, only what came with
GHC. Lots of headers missing and other compilation
problems. configure.sh probably didn't run, as well.

Is there no way to get binary objects from hackage, for the C parts at
least, so that GHC can just link the Haskell parts against it?


Alas, that would be nice :(

It's probably best to wait for the next Haskell Platform instead of instal

[Haskell-cafe] Re: Installing Haskell on Windows 7

2009-12-27 Thread Lee Houghton

On 27/12/2009 17:42, Duncan Coutts wrote:

Okay, the same with "--user" succeeds. Yay!


Right, global installs require admin permissions.

Historically Windows users did have admin permissions so the Windows
folks advised us that global should be the default. Obviously that's not
such a good default on Windows Vista or Windows 7. I've been agitating
to switch the default to per-user installations for a while now:

http://hackage.haskell.org/trac/hackage/ticket/465

I've not got much feedback from the Windows Haskell hacker. In the
development version of cabal-install I'm going to experimentally switch
the default to per-user installs and see how that goes.


Speaking as a Windows 7-using Haskeller, I'd be very glad if user install were 
to become the default. (And even on Windows XP, it is still recommended not to 
write to Program Files during normal usage.) I agree with the assessment in 
http://hackage.haskell.org/trac/hackage/ticket/465#comment:2 too.

Don't forget http://hackage.haskell.org/trac/hackage/ticket/466. This can also cause 
failing in the default setup, even with --user installs. Presumably this would be 
addressed by switching to the same thing cabal does on other platforms, which is to use 
"$prefix/share" or similar.

___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Handles with their IOMode in their type

2009-12-08 Thread Lee Houghton

On 08/12/2009 03:54, Bas van Dijk wrote:

Could not get to sleep tonight so I got up and hacked this together:

http://hpaste.org/fastcgi/hpaste.fcgi/view?id=13782

Does something like this already exist on hackage:

If not, I may turn this into a package and upload it tomorrow.

Comments, criticism and patches are welcome.

regards,

Bas


I like this idea.

A small observation, though:


stdin :: ReadModes ioMode => Handle ioMode
stdin = Handle SIO.stdin


This allows writing to stdin by choosing ReadWriteMode as the ioMode. I think 
it would be better to have just

stdin :: Handle ReadMode


*HandleExplicitIOMode> hPutStrLn (stdin :: Handle ReadWriteMode) "This shouldn't 
typecheck!"
*** Exception: : hPutStr: illegal operation (handle is not open for 
writing)

This also shows another reason for stdin, stdout and stderr to be monomorphic:


hGetLine stdin

:1:0:
Ambiguous type variable `ioMode' in the constraint:
  `ReadModes ioMode'
arising from a use of `hGetLine' at :1:0-13
Probable fix: add a type signature that fixes these type variable(s)


___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe