[Haskell-cafe] what's the best environment for haskell work?
Hamish Mackenzie
hamish.k.mackenzie at googlemail.com
Fri Aug 6 00:11:14 EDT 2010
On 5 Aug 2010, at 21:12, David Virebayre wrote:
> For example, .
>
> Here's an example without, and with candy :
>
> listeEtageres = flip zip [1..] -- on les numérote
> . nub -- on élimine les doublons
> . sort -- on les trie
> . map simple -- on ne garde que le type et la position
> $ listeEtagTot -- on part de la liste totale des étagères
> where simple (_arm,tpe,pos) = (tpe,pos)
> f n (t,p) = (n,t,p)
> --------------------------------
> listeEtageres = flip zip [1..] -- on les numérote
> ∘nub -- on élimine les doublons
> ∘sort -- on les trie
> ∘map simple -- on ne garde que le type et la position
> $ listeEtagTot -- on part de la liste totale des étagères
> where simple (_arm,tpe,pos) = (tpe,pos)
> f n (t,p) = (n,t,p)
> -------------------------------------------
I can't think of a solution to this that will work for people who don't care about non candy alignment and want " . " to appear as a single character. I am afraid for the foreseeable you only have two options
1) Turn of candy
2) Edit your candy configuration file
>> Does your existing editor handle candy better? If so how?
> It doesn't handle them at all :)
Switch it off then. You won't miss it :-)
>> Thanks for the feedback, please let us know if you think of anything else.
>
> This is an example of how i'm confused.
> In this example, I'm trying to load a single file. It's for test
> purposes only, I only need it made by ghc --make, I don't need a cabal
> package.
>
> $ cd code/euler
> $ leksah Euler.hs
Ok so the problem here is that for leksah to work properly we really want a .cabal file. The other issue is that you can only have one cabal file per directory. This came up recently on the Leksah group and I have been pondering what to do.
Can you try out this...
~/haskell/test$ cat ~/bin/cabal_quick_init
#!/bin/sh
SOURCE_FILE=$1
CABAL_NAME=`basename -s .lhs $SOURCE_FILE`
CABAL_NAME=`basename -s .hs $CABAL_NAME`
echo Creating Cabal Package $CABAL_NAME
echo For file $SOURCE_FILE
mkdir $CABAL_NAME.package || exit
cd $CABAL_NAME.package || exit
cabal init -n -p $CABAL_NAME --is-executable --source-dir=.. || exit
sed -e "s/-- *[mM]ain-[iI]s *\:/Main-is:$SOURCE_FILE/" -i "" $CABAL_NAME.cabal || exit
~/haskell/test$ cabal_quick_init Euler.hs
Creating Cabal Package Euler
For file Euler.hs
Generating LICENSE...
Warning: unknown license type, you must put a copy in LICENSE yourself.
Generating Setup.hs...
Generating Euler.cabal...
Warning: no synopsis given. You should edit the .cabal file and add one.
You may want to edit the .cabal file and add a Description field.
This will make a Euler/Euler.cabal file. You can then simply add that .cabal file to your workspace (right click in the Workspace pane).
If this works I will add something like it in Leksah as Package -> Cabalize Existing Code. You will then be asked to choose a Main source file and if you need the package to be in a subdirectory.
I'll try to fix "leksah Euler.hs" so it does the following
* if the file belongs to an package in the workspace open the file and activate the package
* if not ask the user if they want to simply open it or cabalize it
> So I understand why the package menus didn't work, but there was no
> alert while I was in leksah. And it did crash when I clicked on
> Package->Edit flags (reproductible)
>
> Now I create a workspace since I have to.
> On the browser I still don't have access to my file.
> Make workspace does nothing, and tells me nothing. I suspect I need a package.
This is a bit crap. We have been thinking of adding a default workspace. But perhaps a better/simple solution is to prompt the user whenever this happens and ask if they would like to create a workspace or open an existing one.
> So I'm creating a package. When I click save, it creates a Main.hs file for me.
> Right now I'm kind of annoyed, I just wanted to edit Euler.hs, add
> another problem to it, compile, run, and get on with something else.
> That's usually where I close leksah, and lauch kate.
>
> For another programs (that compile fine with ghc --make), I didn't
> bother making the package. But I had to find out the package
> dependencies by building, checking where it fails, and trying to add a
> package to the dependency list. Maybe there's a better way, didn't
> find it.
We do plan to fix this in the same way we resolve missing imports. I had a look to see if I could do it when a user cabalizes the source, but "ghc --make -v" does not include the packages automatically loaded in its output. Instead we will need to wait for the error then resolve it when the user presses Ctrl+R.
Hamish
More information about the Haskell-Cafe
mailing list