[Haskell-cafe] Upgrading GHC 7.6.3 global packages to latest versions

2013-06-28 Thread Rouan van Dalen
Hi,

I am trying to install the latest version of some hackage packages I use often 
in GHC 7.6.3.

However, I am having some problems with packages like [containers] and [time], 
which
are shipped with GHC as global packages.

Now when I try to install the latest version of the [time] package, I have 2
time packages, 1 in the global package db (the older version), and 1 in the 
user package db
(the newer version).

Now I would like subsequent installed packages to always use the latest version 
of the [time]
package.  But if i try to install the [plugins] package, cabal says:

#In order, the following would be installed:
#ghc-paths-0.1.0.9 (new package)
#random-1.0.1.1 (reinstall) changes: time-1.4.1 - 1.4.0.1
#plugins-1.5.3.0 (new package)

So I guess I have 2 options here:

1. unregister all the global packages so that I can
install the latest versions of all the global packages.

2. force cabal to only look at latest packages in user package db (not sure
if this is possible).

Can anyone please point me in the right direction here.  I have read about
[cabal-dev], but I am not sure if it can be used to solve my problem.

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


[Haskell-cafe] Why does Enum succ and pred functions throw exception

2012-06-21 Thread Rouan van Dalen
Hi everyone,

Can anyone shed some light on why the succ and pred functions of the Enum 
typeclass throw
exceptions if we go over the upper or lower boundary, and not return Maybe a?

I was hoping to have some functions like:

  safeSucc :: (Enum a) = a - Maybe a

Because the succ and pred functions throw exceptions I can only catch them in
the IO monad.  This makes it hard to deal with this situation in pure code.

Regards

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


[Haskell-cafe] struggling with blocking shell cmd when using System.Process

2012-03-20 Thread Rouan van Dalen
Hi Everyone,

I am strugling to get the following code to work correctly and I'm hoping
someone will be able to shed some light as to why the code is behaving
as it does:

   {-| runs the supplied command and args as a SHELL command -}
   runShell :: String - IO (String, ExitCode)
   runShell shellCmd = do
  (_, Just hOut, Just hErr, hProcess) - createProcess (shell shellCmd) { 
std_out = CreatePipe, std_err = CreatePipe }
  exitCode - waitForProcess hProcess
  outTxt - hGetContents hOut
  errTxt - hGetContents hErr
  return $ (outTxt ++ errTxt, exitCode)


If I try to su the runShell function with the following command, it simply
blocks forever:

    git --no-pager blame your git file here

but if I do:

    git status

The runShell function works as expected.  Can someone shed some light on why 
the 'git blame' command blocks?  Interrestingly enough, if I remove the 
waitForProcess action, the 'git blame' command starts working as expected, but 
I no longer have my blocking behaviour, waiting for the command to finish and 
return the ExitCode.

Regards

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


[Haskell-cafe] struggling with blocking shell cmd when using System.Process - part 2

2012-03-20 Thread Rouan van Dalen
Hi Everyone,

I forgot to say, I am running GHC 7.2.2 on Windows7 x64.

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


[Haskell-cafe] is the evaluation order deterministic when using applicative with IO

2012-03-16 Thread Rouan van Dalen
Hi everyone.

I was wondering if I can make assumptions about the evaluation order of
the following code:

isTrue :: Int - IO Bool
isTrue val = pure (||) * boolTest1 val * boolTest2 val


{- boolTest1 is an inexpensive, quick check -}
boolTest1 :: Int - IO Bool
boolTest1 val = undefined



{- boolTest2 is a very expensive check -} 

boolTest2 :: Int - IO Bool

boolTest2 val = undefined


When using Applicative in the isTrue function, I would like to make use of
the short-circuit behaviour of || and rely on the fact that the boolTest1
will be executed first.  The reason I am asking is because the boolTest 
functions
are in the IO monad, instead of just returning pure Bool values.

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


[Haskell-cafe] Idiomatic error handling in Haskell

2011-03-02 Thread Rouan van Dalen
There are quite a few exception handling mechanisms provided by Haskell,
as can be seen from this post: 
http://www.randomhacks.net/articles/2007/03/10/haskell-8-ways-to-report-errors

I would like to know what is the preferred Haskell mechanism for handling 
exceptions in
the IO monad?  I am not concerned with mechanisms such as Maybe / Either, but 
would like
to know about exception mechanisms inside the IO monad.

The 2 I know of are:
  o) throwDyn 
  o) ioError and catch

I do need the exceptions to be extendable.  So which is the preferred way
to handle exceptions in Haskell for new libs?


  

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


[Haskell-cafe] Tree Semantics and efficiency

2009-06-17 Thread Rouan van Dalen

Hi everyone.

I would like to confirm the following semantics.

I want a tree which can be traversed both downwards and upwards.
To do this i need to store the following for each node:

o) a reference to the parent node (so we can traverse up the tree).  This must 
be a reference as i dont want to copy the parent node each time)
o) a list of child nodes that belong to this node.

It is important to store only a reference to the parent and not a copy of the 
entire parent for efficiency.

How would one write this in Haskell so that it has the above mentioned 
semantics.
Or does GHC do that automatically for me so I don't need to do it explicitly?

I am thinking of writing something like this (naive implementation) :

 Tree = TreeNode String Tree [Tree]  -- TreeNode data ParentReference 
ChildNodes

OR (implementation using IORef for parentNode reference)

Tree = TreeNode String (IORef Tree) [Tree]  -- TreeNode data 
ParentReference ChildNodes


Thanks in advance

Rouan.




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


[Haskell-cafe] Writing a compiler in Hakell

2009-05-06 Thread Rouan van Dalen

Hi everyone.

I am designing my own programming language.

I would like to know what is the best way to go about writing my compiler in 
haskell.
What are the tools available in haskell that can help with compiler 
construction?

I know about Happy.  Is that a good tool to use?

The compiler is intended for serious use and I would like it to be very 
efficient, maybe competing
with compilers written in C.  It should also be very easy to extend as the 
languoge grows.

Are there any good books that you can recommend on compiler construction in 
general and specific to haskell?


On another note, how is the operator + implemented in haskell?

is there a primitve (say #+) that is wrapped by the haskell operator +?
Maybe something like:

(+) :: a - a - a
v1 + v2 = #+ v1 v2




Thanks in advance

Rouan.




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


[Haskell-cafe] Writing a compiler in Hakell (continued 1)

2009-05-06 Thread Rouan van Dalen

Hi everyone.

Thanks for the speedy replies.

Let me elaborate on my language and situation.

The language I have in mind is a statically typed, hybrid (OOP + functional), 
strict language.
It contains both functional and imperitive features (much the same as OCaml/F#)
with ideas from haskell, scheme, smalltalk, mozart/oz, F#, C#.
The syntax is kept as succint as possible, adding things that I think would be 
useful that are
not defined in any of the inspirational languages.

As for the target language, im not quite sure yet.  I am doing a lot of work in
.NET/C# at the moment, but I would eventually like to use my own programming 
language,
instead of C#.  I would also like to use my language for linux programming, so 
I will eventually
support both Windows and Linux environments.

My aim with this project is to further explore haskell and deepen my 
understanding of it, while at
the same time creating something useful where I can explore my own ideas about 
programmnig
languages and concepts.  I don't really intend to write the next programming 
language used by billions of people.
If others find it useful, that's awsome.  I definitely intend to use my 
language for my own projects and
to make it freely availble on the net.  So it is not just for learning or fun, 
it is more focused on implementing
a decent programming language that can be used for commercial applications (and 
fun).

The compiler for my language should have a decent compile time, comparing to 
compilers written in C.

The approach that I have in mind is to piggy back on existing 
languages/compilers until their implementation
is no longer adequite or I have time to write my own code generator.  So the 
first stage would be something like
translate to C# and then use the C# compiler to obtain an executable.  I want 
the first steps to go as quick as possible
so that I can refine the language and test ideas quickly, and once the language 
has stabalized, concentrarte on my
own full fledged compiler (if it is necessary).

I think I will try Parsec as a starting point for creating a parser.

Thanks again everyone.

Regards
Rouan




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


[Haskell-cafe] daemon process

2008-10-20 Thread Rouan van Dalen
Hi Everyone.

I have been learning Haskell the past few months and there are tons of things
I still don't understand :)

I would like to write a very very simple haskell daemon that disconnects itself 
from the terminal
and sists in the background doing something.

What is the easiest way to go about this.  I have tried several things but 
can't seem to
get the process disconnected from the terminal.

Thanks in advance

Rouan


Send instant messages to your online friends http://uk.messenger.yahoo.com
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe