3
votes

I don't know the best way to solve a simple (probably) problems (hackage related).

I asked for help about it (http://stackoverflow.com/questions/12841599/haskell-hackage-ghc-and-productivity-what-to-do) but I knew not explain well.

Today, I'm with a this kin problem.

The concrete problem isn't relevant, but is it:

`Write a function that, given a string, remove diacritics.`

Example:

`simpleWord "Cigüeñal" <-> "Ciguenal"

The correct way (I think) is to use the standard Unicode normalization. In some languages/frameworks (.Net, PHP, Python, ...) exist some related function.

In Haskell, thanks to hackage community exist too:

`Text.Unicode.Normalization.normalize`

But, I couldn't install with (eg) ghc-7.4 but compact-string (that depends of) fail.

A fix for compact-string exists (compact-string-fix) then: can't I use cabal to install (directly)?, should I download and patch it?, should I look for another alternative to function about?

I explained a concrete real case (simple or complex, don't care), the question (that I ask help for) is how can, a novice haskeller, know the best way to select correct libraries, ghc correct (balanced) version, without hit a wall.

I'm really lost about it.

Really, thank you very much for any suggestion.

Best regards.

2
Daniel gave the solution to this specific problem. I don't think there's a general answer to your question. cabal-dev and virthualenv are partial solutions to package dependency problems (though they wouldn't help in this specific case). I think it's mostly time spent working with Haskell projects and getting experience with using cabal and Hackage.asm

2 Answers

11
votes

The documentation for compact-string says, "This package is obsolete. Use text instead.".

The documentation for text says, "To use an extended and very rich family of functions for working with Unicode text (including normalization, regular expressions, non-standard encodings, text breaking, and locales), see the text-icu package.".

The documentation for text-icu shows that it successfully builds on GHC 7.4 and has support for Unicode normalization.

1
votes

Here's the general process I follow when deciding which packages to use. First, I try to identify multiple packages that meet my needs. Then I look more closely at each package to try to determine which ones are the best for me, according to the criteria listed below.

  1. It's usually better to use packages that are currently maintained. To determine if a package is currently maintained, I check the "Upload date" link on the package description page. (Of course, there are some old tried-and-true packages that haven't been modified in ages because they don't need modification.)

  2. It's usually better to use packages that are mature, so I check the version number on the package description page. A package with a version number of 7.3.5 is probably more mature than a version 0.1 package.

  3. It's usually better to use packages that are well documented. Sometimes there's a nice example of how to use the package in the Haddock documentation (yay!). I'll also check the "Home page" link on the package description page, because often there will be more documentation there.

  4. It's usually better to use packages that are popular, because any problems will probably be addressed quickly, and other users can answer questions. I'll usually do a Google search and see whch packages are mentioned most often on Haskell mailing lists and StackOverflow.

  5. It's usually better to use packages that don't require a lot of packages I don't already have, so I check the "Dependencies" section on the package description page.

I tend to follow this procedure when choosing a package for any programming language, not just Haskell.