Re: [Haskell-cafe] :Trace has no history

2010-09-01 Thread Pepe Iborra
The debugger only instruments interpreted code, so evaluations
occurring inside library code do not show up in :trace. This is not a
terrible problem in practice, since usually seeing the evaluations
occurring in your code is what you need to debug the problem.

But since :trace is not showing you any evaluations at all, I wonder
if the problem might be that your code is not interpreted.
In order to ensure that it is, delete all the *.hi and *.o temporary
files lying around. You can also simply invoke ghci with the
-fbyte-code command line option.

If that fails, please complete the paste of your session below with
your invocation of ghci. There might be something else going on.

Thanks,
pepe

On Wednesday, September 1, 2010, Steve Severance  wrote:
> How do I tell? Does this mean that if the exception is occurring in a
> haskell library I can't get to it? I am trying to run down a
> Prelude.read: No Parse error and I need to see the value that it is
> failing to parse on.
>
> Thanks.
>
> Steve
>
> On Tue, Aug 31, 2010 at 11:05 AM, Pepe Iborra  wrote:
>> Hi Steve
>>
>> The debugger only traces calls in interpreted code. Perhaps the call
>> to myMethod is being made from object code?
>>
>> Admittedly, the ghci debugger can take some effort to learn to use
>> properly. Make sure that you give a look to the ghc user guide if you
>> haven't done so yet.
>>
>>
>> Best,
>> pepe
>>
>> On Tuesday, August 31, 2010, Steve  wrote:
>>> I am trying to debug a problem in GHCI. I invoke my method with trace
>>> but when it breaks on exception i can't get this history. Output is
>>> below. Thanks.
>>>
>>>
>>> relude Symbols> :set -fbreak-on-exception
>>> Prelude Symbols> :trace myMethod
>>> Loading package HUnit-1.2.2.1 ... linking ... done.
>>> Loading package syb-0.1.0.2 ... linking ... done.
>>> Loading package base-3.0.3.2 ... linking ... done.
>>> Loading package old-locale-1.0.0.2 ... linking ... done.
>>> Loading package time-1.1.4 ... linking ... done.
>>> Loading package random-1.0.0.2 ... linking ... done.
>>> Loading package QuickCheck-1.2.0.0 ... linking ... done.
>>> Loading package Decimal-0.1.0 ... linking ... done.
>>> Loading package array-0.3.0.0 ... linking ... done.
>>> Loading package Diff-0.1.2 ... linking ... done.
>>> Loading package bytestring-0.9.1.5 ... linking ... done.
>>> Loading package containers-0.3.0.0 ... linking ... done.
>>> Loading package mtl-1.1.0.2 ... linking ... done.
>>> Loading package old-time-1.0.0.3 ... linking ... done.
>>> Loading package convertible-1.0.9 ... linking ... done.
>>> Loading package utf8-string-0.3.4 ... linking ... done.
>>> Loading package HDBC-2.2.6 ... linking ... done.
>>> Loading package HDBC-mysql-0.6.3 ... linking ... done.
>>> Loading package parsec-2.1.0.1 ... linking ... done.
>>> Loading package network-2.2.1.7 ... linking ... done.
>>> Loading package HTTP-4000.0.9 ... linking ... done.
>>> Loading package binary-0.5.0.2 ... linking ... done.
>>> Loading package digest-0.0.0.8 ... linking ... done.
>>> Loading package filepath-1.1.0.3 ... linking ... done.
>>> Loading package unix-2.4.0.0 ... linking ... done.
>>> Loading package directory-1.0.1.0 ... linking ... done.
>>> Loading package pretty-1.0.1.1 ... linking ... done.
>>> Loading package zlib-0.5.2.0 ... linking ... done.
>>> Loading package zip-archive-0.1.1.6 ... linking ... done.
>>> Loading package Core-0.0.1 ... linking ... done.
>>> Beginning Update
>>> Stopped at 
>>> _exception ::
>>>  e = GHC.Exception.SomeException (GHC.Exception.D:Exception _
>>>
>>> (GHC.Show.D:Show ...) )
>>>                                  (GHC.IO.Exception.IOError Nothing
>>> GHC.IO.Exception.UserError )
>>> [] Prelude Symbols> :history
>>> Empty history. Perhaps you forgot to use :trace?
>>> ___
>>> Haskell-Cafe mailing list
>>> Haskell-Cafe@haskell.org
>>> http://www.haskell.org/mailman/listinfo/haskell-cafe
>>>
>>
>> --
>> -- José Iborra        http://www.dsic.upv.es/~jiborra
>> -- UPV Valencia       Telf. (+34) 96 387 00 00 (ext) 83529
>> -- Camino de Vera s/n. 46022 Valencia (Spain)
>>
>
>
>
> --
> 
> Steve Severance
> c. 240.472.9645
> e. st...@medwizard.net
> 
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

-- 
-- José Iborrahttp://www.dsic.upv.es/~jiborra
-- UPV Valencia   Telf. (+34) 96 387 00 00 (ext) 83529
-- Camino de Vera s/n. 46022 Valencia (Spain)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] :Trace has no history

2010-08-31 Thread Pepe Iborra
Hi Steve

The debugger only traces calls in interpreted code. Perhaps the call
to myMethod is being made from object code?

Admittedly, the ghci debugger can take some effort to learn to use
properly. Make sure that you give a look to the ghc user guide if you
haven't done so yet.


Best,
pepe

On Tuesday, August 31, 2010, Steve  wrote:
> I am trying to debug a problem in GHCI. I invoke my method with trace
> but when it breaks on exception i can't get this history. Output is
> below. Thanks.
>
>
> relude Symbols> :set -fbreak-on-exception
> Prelude Symbols> :trace myMethod
> Loading package HUnit-1.2.2.1 ... linking ... done.
> Loading package syb-0.1.0.2 ... linking ... done.
> Loading package base-3.0.3.2 ... linking ... done.
> Loading package old-locale-1.0.0.2 ... linking ... done.
> Loading package time-1.1.4 ... linking ... done.
> Loading package random-1.0.0.2 ... linking ... done.
> Loading package QuickCheck-1.2.0.0 ... linking ... done.
> Loading package Decimal-0.1.0 ... linking ... done.
> Loading package array-0.3.0.0 ... linking ... done.
> Loading package Diff-0.1.2 ... linking ... done.
> Loading package bytestring-0.9.1.5 ... linking ... done.
> Loading package containers-0.3.0.0 ... linking ... done.
> Loading package mtl-1.1.0.2 ... linking ... done.
> Loading package old-time-1.0.0.3 ... linking ... done.
> Loading package convertible-1.0.9 ... linking ... done.
> Loading package utf8-string-0.3.4 ... linking ... done.
> Loading package HDBC-2.2.6 ... linking ... done.
> Loading package HDBC-mysql-0.6.3 ... linking ... done.
> Loading package parsec-2.1.0.1 ... linking ... done.
> Loading package network-2.2.1.7 ... linking ... done.
> Loading package HTTP-4000.0.9 ... linking ... done.
> Loading package binary-0.5.0.2 ... linking ... done.
> Loading package digest-0.0.0.8 ... linking ... done.
> Loading package filepath-1.1.0.3 ... linking ... done.
> Loading package unix-2.4.0.0 ... linking ... done.
> Loading package directory-1.0.1.0 ... linking ... done.
> Loading package pretty-1.0.1.1 ... linking ... done.
> Loading package zlib-0.5.2.0 ... linking ... done.
> Loading package zip-archive-0.1.1.6 ... linking ... done.
> Loading package Core-0.0.1 ... linking ... done.
> Beginning Update
> Stopped at 
> _exception ::
>  e = GHC.Exception.SomeException (GHC.Exception.D:Exception _
>
> (GHC.Show.D:Show ...) )
>                                  (GHC.IO.Exception.IOError Nothing
> GHC.IO.Exception.UserError )
> [] Prelude Symbols> :history
> Empty history. Perhaps you forgot to use :trace?
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

-- 
-- José Iborrahttp://www.dsic.upv.es/~jiborra
-- UPV Valencia   Telf. (+34) 96 387 00 00 (ext) 83529
-- Camino de Vera s/n. 46022 Valencia (Spain)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: [Haskell] Woes on MacOS 10.6 - linking issues

2010-06-11 Thread Pepe Iborra
(moving to the cafe)

There is an incompatibility between the version of iconv in Mac Os and
the one included in MacPorts.
As the RTS of the build of ghc in the Haskell Platform is linked
against Mac Os iconv, you cannot use it with the build of gtk2hs from
MacPorts.

This is a known issue already commented elsewhere, in case you haven't
found it already:

http://www.mail-archive.com/haskell-cafe@haskell.org/msg69139.html
http://stackoverflow.com/questions/2726248/ghc-6-12-and-macports

Cheers,


On Fri, Jun 11, 2010 at 4:53 AM, Brett Giles  wrote:
> Hi Folks
>
> I seem to have Gtk2HS 0.11 installed, but not quite working. Interestingly, I 
> can run a demo, such as the hello/World.hs example, directly in ghci. 
> However, when I try to do a ghc --make on any code containing gtk2hs I get a 
> link error like this:
>
> Undefined symbols:
>  "_iconv_close", referenced from:
>      _hs_iconv_close in libHSbase-4.2.0.0.a(iconv.o)
>     (maybe you meant: _hs_iconv_close)
>  "_iconv", referenced from:
>      _hs_iconv in libHSbase-4.2.0.0.a(iconv.o)
>     (maybe you meant: _hs_iconv_open, _hs_iconv , _hs_iconv_close )
>  "_iconv_open", referenced from:
>      _hs_iconv_open in libHSbase-4.2.0.0.a(iconv.o)
>     (maybe you meant: _hs_iconv_open)
> ld: symbol(s) not found
>
>
> I do have libiconv installed as a universal library via macports. gtk, glade 
> etc., are also universal installed via macports.
>
> I downloaded the OSX Haskell Platform package and am running ghc 6.12.1
>
> Other programs seem to be having some issues as well though,  For instance, a 
> command line program seems to compile fine, but when it runs I get the 
> message:
>
> $ emlqpl (<<<--- My "successfully" compiled program - batch only, no gtk 
> items)
> dyld: Library not loaded: /opt/local/lib/libgtk-quartz-2.0.0.dylib
>  Referenced from: /usr/local/bin/emlqpl
>  Reason: image not found
> Trace/BPT trap
>
>
>
> Does anyone have any suggestions?
>
> Brett Giles
> Grad Student, Formal Methods, Category Theory,
> University of Calgary
> brett.gi...@ucalgary.ca
>
>
>
> ___
> Haskell mailing list
> hask...@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell
>



-- 
-- José Iborrahttp://www.dsic.upv.es/~jiborra
-- UPV Valencia   Telf. (+34) 96 387 00 00 (ext) 83529
-- Camino de Vera s/n. 46022 Valencia (Spain)
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Associative Commutative Unification

2008-07-11 Thread Pepe Iborra
On Fri, Jul 11, 2008 at 2:39 PM, John D. Ramsdell <[EMAIL PROTECTED]> wrote:
>> Are you aware of "Term Rewriting and all That"? It describes how to do
>> associative commutative unification; whether it satisfies your
>> 'obviously correct' criterion I don't know.
>
> Oh yes, I know about term rewriting.  If your equations can be
> expressed as a set of confluent rewrite rules, one can use the
> Martelli and Montanari's formalization of unification to come up with
> an obviously correct equational unifier.  Alas, that simple trick
> doesn't work for AC unification.
>
> Have you heard of Maude?  I hear the next version will have support
> for AC unification.  If I stay with Haskell, I'd have to use their
> support via interprocess communication.  Yuck.
>
> http://maude.cs.uiuc.edu/
>
> John
> ___
> Haskell-Cafe mailing list
> Haskell-Cafe@haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>

You are surely aware that AC unification is much more difficult than
syntactical unification.
CIMe[1] might be useful to solve the generated diophantine equations.
But I don't think you will be able to obtain obvious correctness, and
probably performance neither.

I don't know what you are planning to do, but perhaps you'd be better
served by Maude than by Haskell.
The Maude language is a joy to use and version 2.4 with AC unification
is (expectedly) being released next week in RTA.

Cheers
pepe

[1] - http://cime.lri.fr/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] isWHNF :: a -> IO Bool ?

2007-09-27 Thread Pepe Iborra
Very cool.  This is much nicer than when I asked much the same  
question a few years back (and I can think of all sorts of  
interesting things I can learn from the interface in that module).   
But what about indirection chasing?  Surely we want isWHNF to  
return True if we have an indirection to a WHNF.  Possibly one  
wants something a bit like this (untested, and rather depends on  
GHC's indirection semantics):


removingIndirections :: (forall c . c -> IO b) -> a -> IO b
removingIndirections k a = do
closureData <- getClosureData a
if isConstr (tipe closureData) then
removingIndirections (ptrs closureData ! 0)
else
k a


simpleIsWHNF :: a -> IO Boolean
simpleIsWHNF =  fmap (isConstr . tipe) . getClosureData

isWHNF = removingIndirections simpleIsWHNF



Very true, isWHNF needs to follow indirections indeed. To decide  
whether to recurse, you probably intended to test for Indirections  
and not for Constructors:



removingIndirections :: (forall c . c -> IO b) -> a -> IO b
removingIndirections k a = do
closureData <- getClosureData a
if isIndirection (tipe closureData) then
removingIndirections (ptrs closureData ! 0)
else
k a


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


Re: [Haskell-cafe] isWHNF :: a -> IO Bool ?

2007-09-27 Thread Pepe Iborra

Actually, in 6.8 we can build isWHNF on top of the GHC-API.

First, you need to import the ghc package:


ghci -package ghc
GHCi, version 6.7: http://www.haskell.org/ghc/  :? for help


Then, you can define the isWHNF function as follows:


Prelude> :m +RtClosureInspect
Prelude RtClosureInspect> let isWHNF = fmap (isConstr . tipe) .  
getClosureData


Prelude RtClosureInspect> :t isWHNF
isWHNF :: a -> IO Bool


What the code above does is to inspect the info table associated to  
the value given, and check if the closure is a Constructor closure,  
i.e. in WHNF.


We can put it to test now:


Prelude RtClosureInspect> let a = [1..10]
Prelude RtClosureInspect> isWHNF a
False
Prelude RtClosureInspect> seq a ()
()
Prelude RtClosureInspect> isWHNF a
True



As a bonus because this code is included in GHC itself it should stay  
in sync with any changes in the GHC internal representations.


Cheers
pepe

On 27/09/2007, at 14:51, Bernie Pope wrote:


Hi Tristan,

I've implemented it for earlier versions of GHC, by calling some C  
code which then peeps at the internal representation of a value.


From memory, I needed to pass a stable pointer to the value to the  
C code, so that it can be polymorphic, without having to make it a  
primitive in GHC.


Have a look at the "reify" code on this page: http:// 
www.cs.mu.oz.au/~bjpop/code.html - its more than what you want, but  
you can trim it down easily.

Let me know if you get stuck.

The internal representation in GHC tends to change between  
releases, so it might need a bit of polishing up.


Cheers,
Bernie.

On 27/09/2007, at 10:07 PM, Tristan Allwood wrote:


Hi,

Does anyone know if there is a function that tells you if a haskell
value has been forced or not?

e.g.
isWHNF :: a -> IO Bool

let x = (map succ [0..]) in do
  putStrLn . show (isWHNF x)-- False
  putStrLn . show . head $ x
  putStrLn . show (isWHNF x)-- True
  putStrLn . show (isWHNF (Just undefined)) -- True


If not, would it be hard/easy/possible to implement on-top-of or  
using

GHC?  I'm happy (if it's possible) to have a stab at implementing it
myself, so any pointers to right directions would be helpful.

I'm thinking it could be useful to allow creation of sparse-check [1]
like libraries without needing a separate logic encoding, or things
along those lines / in that area.

Cheers,

Tris

[1] http://www-users.cs.york.ac.uk/~mfn/sparsecheck/index.html#lim

--
Tristan Allwood
PhD Student
Department of Computing
Imperial College London
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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


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


Re: [Haskell-cafe] Monad.Reader 8: Haskell, the new C++

2007-09-13 Thread Pepe Iborra
For a taste, see Instant Insanity transliterated in this functional  
language:


http://hpaste.org/2689



I thought I'd better paste here the code for Instant Insanity with  
Type Families. Otherwise it will vanish in a short time.

I took the opportunity to clean it up a bit.

Although AT are not a supported feature, the code works in a 6.8.1  
snapshot.
But note that you cannot actually see the solution, as there is no  
way to ask

GHCi to display the normalized types.

My favorite bit is:
*>  type instance Map f Nil = Nil
*>  type instance Map f (x:::xs) = Apply f x ::: Map f xs

\begin{code}
  import Prelude hiding (all, flip, map, filter)
  u = undefined

  data R  -- Red
  data G  -- Green
  data B  -- Blue
  data W  -- White

  data Cube u f r b l d

  type CubeRed = Cube R R R R R R
  type CubeBlue = Cube B B B B B B
  type Cube1 = Cube B G W G B R
  type Cube2 = Cube W G B W R R
  type Cube3 = Cube G W R B R R
  type Cube4 = Cube B R G G W W

  data True
  data False

  type family And b1 b2
  type instance And True  True = True
  type instance And True  False= False
  type instance And False True = False
  type instance And False False= False

  data Nil
  data Cons x xs
  data x ::: xs
  infixr 5 :::

  type family ListConcat l1 l2
  type instance ListConcat Nil l = l
  type instance ListConcat (x:::xs) ys = x:::(ListConcat xs ys)

  type family Apply f a

  data Rotation
  data Twist
  data Flip
  type instance Apply Rotation (Cube u f r b l d) = Cube u r b l f d
  type instance Apply Twist(Cube u f r b l d) = Cube f r u l d b
  type instance Apply Flip (Cube u f r b l d) = Cube d l b r f u

  type family Map f xs
  type instance Map f Nil = Nil
  type instance Map f (x:::xs) = Apply f x ::: Map f xs

  type family Filter f xs
  type instance Filter f Nil = Nil
  type instance Filter f (x:::xs) = AppendIf (Apply f x) x (Filter f  
xs)


  type family AppendIf b x ys
  type instance AppendIf True x ys  = x ::: ys
  type instance AppendIf False x ys = ys

  type family MapAppend f xs
  type instance MapAppend f Nil = Nil
  type instance MapAppend f (x:::xs) = ListConcat (x:::xs) (Map f  
(x:::xs))


  type family MapAppend2 f xs
  type instance MapAppend2 f Nil = Nil
  type instance MapAppend2 f (x:::xs)  = ListConcat (x:::xs)  
(MapAppend f (Map f (x:::xs)))


  type family MapAppend3 f xs
  type instance MapAppend3 f Nil = Nil
  type instance MapAppend3 f (x:::xs) = ListConcat xs (MapAppend2 f  
(Map f (x:::xs)))



  data Orientations
  type instance Apply Orientations c = MapAppend3 Rotation (
   MapAppend2 Twist (
   MapAppend Flip (c:::Nil)))
  type family NE x y
  type instance NE R R = False
  type instance NE R G = True
  type instance NE R B = True
  type instance NE R W = True
  type instance NE G R = True
  type instance NE G G = False
  type instance NE G B = True
  type instance NE G W = True
  type instance NE B R = True
  type instance NE B G = True
  type instance NE B B = False
  type instance NE B W = True
  type instance NE W R = True
  type instance NE W G = True
  type instance NE W B = True
  type instance NE W W = False

  type family All l
  type instance All Nil = True
  type instance All (False ::: xs) = False
  type instance All (True ::: xs)  = All xs

  type family Compatible c1 c2
  type instance Compatible (Cube u1 f1 r1 b1 l1 d1) (Cube u2 f2 r2  
b2 l2 d2) =

  All (NE f1 f2 ::: NE r1 r2 ::: NE b1 b2 ::: NE l1 l2)

  type family Allowed c cs
  type instance Allowed c Nil = True
  type instance Allowed c (y ::: ys) = And (Compatible c y) (Allowed  
c ys)


  type family Solutions cs
  type instance Solutions Nil = (Nil ::: Nil)
  type instance Solutions (c ::: cs) = AllowedCombinations (Apply  
Orientations c) (Solutions cs)


  type family AllowedCombinations os sols
  type instance AllowedCombinations os Nil = Nil
  type instance AllowedCombinations os (s ::: sols) =
  ListConcat (AllowedCombinations os sols) (MatchingOrientations  
os s)


  type family MatchingOrientations os sol
  type instance MatchingOrientations Nil sol = Nil
  type instance MatchingOrientations (o ::: os) sol =
  AppendIf (Allowed o sol) (o:::sol) (MatchingOrientations os sol)

  type Cubes = (Cube1 ::: Cube2 ::: Cube3 ::: Cube4 ::: Nil)
  solution = u :: Solutions Cubes

\end{code}
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Monad.Reader 8: Haskell, the new C++

2007-09-13 Thread Pepe Iborra


On 13/09/2007, at 0:06, Don Stewart wrote:


ok:
In Monad.Reader 8, Conrad Parker shows how to solve the Instant  
Insanity
puzzle in the "Haskell" type system.  Along the way he  
demonstrates very

clearly something that was implicit in Mark Jones' "Type Classes with
Functional Dependencies" paper if you read it very very carefully  
(which
I hadn't, but on re-reading it is there).  That is, Haskell types  
plus

multiparameter type classes plus functional dependencies is a logic
programming language.  In fact it is a sufficiently powerful  
language to

emulate any Turing machine calculation as a type checking problem.

So we have

C++ : imperative language whose type system is a Turing-complete
  functional language (with rather twisted syntax)

Haskell: functional language whose type system is a Turing-
  complete logic programming language (with rather twisted
  syntax)

Since not all Turing machines halt, and since the halting problem is
undecidable, this means not only that some Haskell programs will make
the type checker loop forever, but that there is no possible meta-
checker that could warn us when that would happen.

I've been told that functional dependencies are old hat and there is
now something better.  I suspect that "better" here means "worse".


Better here means "better" -- a functional language on the type  
system,

to type a functional language on the value level.

-- Don


For a taste, see Instant Insanity transliterated in this functional  
language:


http://hpaste.org/2689

NB: it took me 5 minutes, and that was my first piece of coding ever  
with Type families



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


Re: [Haskell-cafe] Weird ghci behaviour?

2007-07-24 Thread Pepe Iborra

I can give the following partial explanation.

When you run "ghc test.hs" it compiles your test file and produces  
some auxiliar files at the same time.
When you run ghci afterwards, if the mod. date of the auxiliar files  
is more recent than that of the source file, it directly loads the  
object code form of the source file.
So it appears that ghci is having trouble when loading the object  
code version. Whereas if it's not, it loads the module interpreted.  
Of course, if you remove test.hi, ghci will always load the file  
interpreted, and so the problem doesn't manifest.


Cheers
pepe

On 20/07/2007, at 23:12, Dan Piponi wrote:


On Unix-like OSes:

If I run "ghc test.hs" and then run "ghci test.hs", ghci fails to load
up my code. I have to touch test.hs and then run ghci. I can
understand ghci refusing to recompile something it thinks it has
already compiled. But it appears to refuse to load it into an
interactive session - which is less useful. In fact, removing test.hi
makes ghci work again.

This is ghc 6.6. Anyone else seeing this?
--
Dan
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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


Re: [Haskell-cafe] Practical Haskell question.

2007-06-25 Thread Pepe Iborra


There is a related discussion, with a lot of pointers, in a recent  
D.Piponi blog post:


http://sigfpe.blogspot.com/2007/04/homeland-security-threat-level- 
monad.html




On 25/06/2007, at 10:58, peterv wrote:

I'm baffled. So using the Arrow abstraction (which I don't know  
yet) would
solve this problem? How can (perfectActionB x) be checked with  
without ever
executing performActionA which evaluates to x? This can only be  
done when x

is a constant expression no?

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Tomasz Zielonka
Sent: Monday, June 25, 2007 10:43 AM
To: Henning Thielemann
Cc: haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] Practical Haskell question.

On Mon, Jun 25, 2007 at 10:29:14AM +0200, Henning Thielemann wrote:

Imagine all performActions contain their checks somehow. Let
performActionB take an argument.


 do
   x <- performActionA
   y <- performActionB x
   z <- performActionC
   return $ calculateStuff x y z


Now performActionB and its included check depend on x. That is,  
the check
relies formally on the result of performActionA and thus check B  
must be

performed after performActionA.


IIUC, this limitation of Monads was one of the reasons why John Hughes
introduced the new Arrow abstraction.

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

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


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


Re: [Haskell-cafe] Shim missing Distribution.Verbosity

2007-06-11 Thread Pepe Iborra
Thanks for the report. That was an error I introduced in a previous  
patch, just pushed the fix.


By the way, there is a Shim mailing list at

http://shim.haskellco.de

Cheers
pepe

On 11/06/2007, at 9:22, Johan Grönqvist wrote:


Hi,

I am trying to install shim (http://shim.haskellco.de/trac/wiki) on  
windows XP (GHC 6.6.1). When I run "./Setup.lhs build", ghc tells  
me that the module Distribution.Verbosity can not be found. The  
module is imported by Shim.GhcCompat.


ghcii also tells me that Distribution.Verbosity can not be found.  
When I look at http://www.haskell.org/ghc/docs/latest/html/ 
libraries/index.html, I do not see Distribution.Verbosity there  
either.


I have no idea how to proceed.

Thanks for any help,

Johan

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


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


Re: [Haskell-cafe] Haskell on OS X

2007-05-19 Thread Pepe Iborra
MacPorts works fine here, and the maintainer, Gregory Wright, is very  
supportive.
If it works for you, I really recommend MacPorts. The only downside  
are the lengthy compile times, but this is not a big deal, you can  
just leave it installing overnight.


Carbon Emacs flavour here instead of Aqua, but for no reason in  
particular. I sweeten it with Haskell mode + shim.


On 19/05/2007, at 20:27, Tom Harper wrote:


I use Aquamacs with the haskell mode from haskell.org.  MacPorts
wasn't being useful with ghc, I downloaded binaries, and they work
fine.

On 5/19/07, Johan Tibell <[EMAIL PROTECTED]> wrote:

I just switched to OS X and was wondering if someone would like to
share their setup. Install binaries from haskell.org or Mac Ports?
Which emacs build? etc

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




--
Tom Harper
Computer Science Major '07
Syracuse University
+1 949 235 0185
Public Key: http://aftereternity.co.uk/rth.asc
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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


Re: [Haskell-cafe] Disadvantages of de Bruijn indicies?

2007-05-13 Thread Pepe Iborra


On 13/05/2007, at 12:44, Neil Mitchell wrote:


Hi

Thanks for all the responses, I'm busy reading through them.

I'm still trying to decide whether I should use them or not. They
complicate things, are less intuitive than names. But on the other
hand, the language I'm working in is untyped and has only letrec.
These things make binding errors easier to occur, and harder to
detect.

Thanks for the helpful throughts,

Neil


The Calculus of Indexed Names and Named Indices (CINNI) [1] looks  
really neat:


"The Calculus of Indexed Names and Named Indices (CINNI) is a new  
calculus of explicit substitutions that combines names and indices in  
a uniform way. It contains the standard named notation used in logics  
and programming languages as well as de'Bruijn's indexed notation as  
sublanguages. "



Disclaimer: I haven't read the Epigram paper nor Berkling, so I don't  
know how it compares. And I can't really talk from my own experience,  
since I have not played myself with CINNI yet. I wish I had a build-a- 
language assignment, just so that I could put CINNI to work...


[1] - http://formal.cs.uiuc.edu/stehr/cinni_eng.html

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


Re: [Haskell-cafe] Parallel executing of actions

2007-04-16 Thread Pepe Iborra

On 16/04/2007, at 12:30, Mitar wrote:


Hi!

On 4/16/07, Bertram Felgenhauer  
<[EMAIL PROTECTED]> wrote:

> Since all the threads block on a single MVar how do they run in
> parallel?

The idea is that before the threads block on the MVar, they run their
action x to completion.


The rendering crashes. I will have to precompute the values in threads
someway and then sequentially draw it? Any suggestion how to do that?



Could it be that you are launching 400x300=120.000 new threads all at  
once?
If you are not doing it already, it would be sensible to implement  
some pooling of threads.


This is what I use myself, don't worry about the unsafeness IF you  
know that the sequence of computations doesn't matter:


\begin{code}
unsafeParMapM :: (a -> IO b) -> [a] -> IO [b]
unsafeParMapM f = return . parMap rwhnf (unsafePerformIO . f)

unsafeParMapMn :: Integral bound => bound -> (a -> IO b) -> [a] -> IO  
[b]

unsafeParMapMn max f xx = return (map (unsafePerformIO . f) xx
`using`
  parListChunk (fromIntegral max) rwhnf)

unsafeParSeqn :: Integral bound => bound -> [IO a] -> IO [a]
unsafeParSeqn max cc = return ((map unsafePerformIO cc)
`using`
   parListChunk (fromIntegral max) rwhnf)
\begin{code}


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


Re: [Haskell-cafe] MPTC and type classes issue (polymorphic '+')

2007-04-07 Thread Pepe Iborra
The main problem is that you cannot assume Integral for the values 20  
and 40. Those have types (Num a=>a).
And without the Integral assumption, you cannot define your instance.  
So what I would do is to create a thin wrapper:


>i = id :: Integer -> Integer

and write:

> input2 = [ InputDecs [ inp "emaLength" TyNumber ((i 20) + (i 40)) ] ]

Sometimes the simplest solution is the best one


Cheers
pepe

On 07/04/2007, at 14:35, Joel Reymont wrote:


Pepe,

On Apr 7, 2007, at 1:31 PM, Pepe Iborra wrote:

> input2 = [ InputDecs [ inp "emaLength" TyNumber ((20::Integer) +  
(40::Integer)) ] ]


Thank you for your suggestion! I'm trying to make my AST definition  
as succinct as possible, though, so I would really love to have 20  
+ 40. The issue is confined to a single module used during testing.


Thanks, Joel

--
http://wagerlabs.com/







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


Re: [Haskell-cafe] MPTC and type classes issue (polymorphic '+')

2007-04-07 Thread Pepe Iborra


input2 =
[ InputDecs [ inp "emaLength" TyNumber (20 + 40) ] ]



(untested). Imho the simple, dumb, best fix for this is to give a  
explicit type to those values.


> input2 = [ InputDecs [ inp "emaLength" TyNumber ((20::Integer) +  
(40::Integer)) ] ]



This is just one way to fix it. You could also try to improve your  
instances or enable -foverlapping-instances. But in my experience  
MPTC and overlapping instances, though powerful, can become very  
confusing, very quickly.


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


Re: [Haskell-cafe] Binary I/O

2007-04-02 Thread Pepe Iborra

On 02/04/2007, at 16:26, Daniel Brownridge wrote:


Hello.

I am a Computer Science student attempting to write an emulator  
using Haskell.

One of my main design choices is how to deal with machine code.
Clearly it is possible to represent 0's and 1's as ASCII  
characters, however it strikes me that it would be much nicer to  
the I/O using raw binary. I don't seem to be able to find much  
documentation on this.
Does anybody know how it's done, or can point me in the direction  
of some resources.





Imho, just read directly to an Array and work with that.
Probably you want to look at the OmegaGB Gameboy Emulator project for  
examples.


http://www.mutantlemon.com/omegagb

The code for loading ROM images to an Array of Words:

http://darcs.mutantlemon.com/omegagb/src/RomImage.hs

After that, opcodes are easily parsed by pattern matching on the  
hexadecimal values, e.g. see the mcti function in the Cpu module:


http://darcs.mutantlemon.com/omegagb/src/Cpu.hs

It would be nicer to write a Data.Binary instance for the Instruction  
datatype and use that to do the parsing, but I don't think that  
loading ROM files is a major speed concern here.


Another interesting resource you may want to look at for your  
emulator code can be ICFPC'06 Universal Machine implementations. Don  
Stewart has a page with a few highly performant implementations (and  
there are benchmarks too, yay!):


http://www.cse.unsw.edu.au/~dons/um.html

Cheers
pepe

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


Re: [Haskell-cafe] Parallelism on concurrent?

2007-03-13 Thread Pepe Iborra

Excuse me, I read too quick.
It works for forkIO too, although I'm not sure about forkOS. I don't  
have a demo around, but you can verify with the concurrency demos in  
the wiki:


http://haskell.org/haskellwiki/Concurrency_demos/Zeta

If it doesn't work, perhaps you are in an unsupported platform.

Cheers
pepe

On 13/03/2007, at 18:10, Dusan Kolar wrote:

Yes, it works for operator /par/. That's what I've reported. But  
should it work for forkIO and forkOS? Could anybody give more  
detailed answer than yes, no? :-) (Link to the Web is OK.)


BTW, thanks for the link to the paper (moreover, I can see, that  
googling over haskell.org is not sufficient ;-) ).


Regards,

 Dusan


Pepe Iborra wrote:

On 13/03/2007, at 17:46, Jefferson Heard wrote:

Simon will probably chime in on it as well, but his paper on the  
subject is

the best there is:

http://research.microsoft.com/~simonpj/Papers/strategies.ps.gz


It does work in GHC 6.6 very nicely.
You can try it with the following naive fib function, extracted  
from the paper mentioned above:


\begin{code}
import Control.Parallel
import System.Environment
import Fib

main = do
   (x:_) <- getArgs
   print$ pfib (read x)

pfib 0 = 1
pfib 1 = 1
pfib n = n1 `par` n2 `seq` n1+n2+1
  where (n1,n2) = (pfib(n-1), pfib(n-2))
\end{code}

pep:~/code/snippets/Parallelism$ ghc --make -O Main -threaded

pep:~/code/snippets/Parallelism$ time src/Main 33
11405773

real0m1.444s
user0m1.343s
sys 0m0.020s

pep:~/code/snippets/Parallelism$ time src/Main 33 +RTS -N2
11405773

real0m0.764s
user0m1.367s
sys 0m0.030s



Got a speedup of 100%, and didn't use threads at all. Yay!

pepe

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


--

Dusan Kolartel: +420 54 114 1238
UIFS FIT VUT Brno  fax: +420 54 114 1270
Bozetechova 2   e-mail: [EMAIL PROTECTED]
Brno 612 66
Czech Republic

--



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


Re: [Haskell-cafe] Parallelism on concurrent?

2007-03-13 Thread Pepe Iborra

On 13/03/2007, at 17:46, Jefferson Heard wrote:

Simon will probably chime in on it as well, but his paper on the  
subject is

the best there is:

http://research.microsoft.com/~simonpj/Papers/strategies.ps.gz


It does work in GHC 6.6 very nicely.
You can try it with the following naive fib function, extracted from  
the paper mentioned above:


\begin{code}
import Control.Parallel
import System.Environment
import Fib

main = do
   (x:_) <- getArgs
   print$ pfib (read x)

pfib 0 = 1
pfib 1 = 1
pfib n = n1 `par` n2 `seq` n1+n2+1
  where (n1,n2) = (pfib(n-1), pfib(n-2))
\end{code}

pep:~/code/snippets/Parallelism$ ghc --make -O Main -threaded

pep:~/code/snippets/Parallelism$ time src/Main 33
11405773

real0m1.444s
user0m1.343s
sys 0m0.020s

pep:~/code/snippets/Parallelism$ time src/Main 33 +RTS -N2
11405773

real0m0.764s
user0m1.367s
sys 0m0.030s



Got a speedup of 100%, and didn't use threads at all. Yay!

pepe

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


Re: [Haskell-cafe] Re: AT solution: rebinding >>= for restricted monads

2007-02-27 Thread Pepe Iborra


Did anyone with knowledge of Associated Types pursue this solution?


Where did you get this from.  My haskell-cafe mail folder doesn't seem
to have the thread you are replying to.



Sorry I replied from gmane; I should have included a link to the  
original thread, but I really expected gmane to do that. The thread  
is at:


http://www.haskell.org/pipermail/haskell-cafe/2006-December/020615.html


It doesn't work with GHC head, and I can't really do anything  
about that.

Mostly curiosity.


The main reason this doesn't work with the head is because the
implementation of associated type *synonyms* (as opposed to associated
data types) is still incomplete.  (See also
.)  We are  
working at
the implementation, but I just relocated from New York to Sydney,  
which

is why not much happened in the last two months.

But I also don't quite understand the intention of this code:



I will try to fill in the details, but surely it is all expanded in  
the original thread.


The idea is that we have an indexed/effectful monad where bind and  
return have a parameterized type:


class WitnessMonad m where
  (>>=) :: m a b x -> (x -> m b c y) -> m a c y
  return :: x -> m a a x

We can produce instances of WitnessMonad from an existing Monad using  
an adaptor


newtype WitnessAdaptor m a b x = W {unW::m x}
instance Monad m => WitnessMonad (WitnessAdaptor m)

And rebind the do syntax to our WitnessMonad.
But using vanilla Monads via this trick requires to lift and unlift  
every monadic action with the adaptor. An example in the IO monad:


test1 :: IO String
test1 = unW$ do
  msg <- W getLine
  W$ putStrLn "Thanks!"
  return msg

From here on the intent was on producing a solution using ATs that  
hides this explicit wrapping. I don't really know the details of the  
proposed solution.


Thanks
pepe

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


[Haskell-cafe] Re: AT solution: rebinding >>= for restricted monads

2007-02-26 Thread Pepe Iborra
David Roundy  darcs.net> writes:
> My latest attemp (which won't compile with the HEAD ghc that I just compiled,
> probably because I haven't figured out the synatax for guards with indexed
> types is:
> 
> class WitnessMonad m where
> type W m :: * -> * -> *
> (>>=) :: (WitnessMonad m', WitnessMonad m'',
>   w a b = W m', w b c = W m'', w a c = W m)
>   => m' x -> (x -> m'' y) -> m y
> (>>) :: (WitnessMonad m', WitnessMonad m'',
>   w a b = W m', w b c = W m'', w a c = W m)
>   => m' x -> m'' y -> m y
> f >> g = f >>= const g
> return :: w a a = W m x => -> m x
> fail :: String -> m x
> 
> data Witness a b
> 
> instance Monad m => WitnessMonad m where
> W m = Witness () ()
> (>>=) = Prelude.(>>=)
> (>>) = Prelude.(>>)
> return = Prelude.return
> fail = Prelude.fail
> 
> which I think is quite pretty.  It allows the Monadlike object to have kind
> * -> *, while still allowing us to hide extra witness types inside and pull
> them out using the W function.



Did anyone with knowledge of Associated Types pursue this solution? 
It doesn't work with GHC head, and I can't really do anything about that.
Mostly curiosity. 

Thanks
pepe



Everything from here on is to convince GMane that, even if my message 
contains more quoted text than fresh text, it is a legitimate message and it 
should be ok to post it. 

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


Re: [Haskell-cafe] Safe lists with GADT's

2007-02-26 Thread Pepe Iborra
I am really curious about this style of programming, and find myself  
playing with it from time to time.
The example so far is very nice, but the funniest part is missing.  
That is, defining appendL.


> appendL :: List a t1 -> List a t2 -> List a t3

This says that the append of a list of length t1 and a list of length  
t2 is a list of whatever length t3 we want. Obviously this is not  
true and will not typecheck.
After some healthy days of reading papers and theses, I've found at  
least three ways of defining it.


First, via existentials:
> appendL1 :: List a t1 -> List a t2 -> exists t3. List a t3

Second, attaching a proof. Question: what would be the advantage of  
the proof here?
> data Add a b c where Base :: Add NilT a a ; Step :: Add a b c ->  
Add (ConsT a) b (ConsT c)
> appendL2 :: List a t1 -> List a t2 -> exists t3. (Add t1 t2 t3,  
List a t3)


Third, via Type Classes.
\begin{code}
class AddList a b c | a b -> c
where append :: List x a -> List x b -> List x c
instance AddList NilT b b
where append Nil x = x
instance AddList a b c => AddList (ConsT a) b (ConsT c)
where append (Cons x l) l' = Cons x (append l l')
\end{code}


Given the three methods, I wouldn't know which one should be  
preferred, and why.

In the first one you pay the burden of programming with existentials.
The second one in addition to that is the least efficient, as  
building the proof surely has a cost. Since we are building it, isn't  
there a way to use it to remove the existential?
Finally, with the third one your compiler will produce error messages  
that will make you swear, apart from possible efficiency losses too.


Thanks for reading, any hints will be appreciated
pepe

On 26/02/2007, at 15:26, David Roundy wrote:


On Sun, Feb 25, 2007 at 10:40:13PM +, Neil Mitchell wrote:

data ConsT a
data NilT

data List a t where
   Cons :: a -> List a b -> List a (ConsT b)
   Nil  :: List a NilT

...

Defining safeMap was trivial, but one thing I couldn't figure out was
how to write something like fromList:

fromList [] = Nil
fromList (a:as) = Cons a (fromList as)

fromList could obviously be anything such as reading from a file etc,
where the input is not known in advance. Are there any techniques for
this?


My favorite ways to wrap an existential is with another GADT:

data Existential a where Existential :: a b -> a

(Yes, properly speaking this isn't a GADT, just an existential ADT,  
but

it's easier for me to understand this way.)

Then

fromList [] = Existential Nil
fromList (a:as) = case fromList as of
  Existential as' -> Existential (Cons a as')

This is a pretty easy way to deal with the fromList.  You'll now  
also want
(which I don't think you mentioned in your example code) a GADT  
version of

null, and perhaps other length operators:

data NullT t where
  IsNull :: NullT NilT
  NotNull :: NullT (ConsT t)

nullL :: List a t -> NullT t

so you can now actually use your head function on a dynamically  
generated

list, by running something like (e.g. in a monad)

   do cs <- readFile "foo"
  Existential cs' <- return $ fromList cs
  -- note: we'll pattern-match fail on non-empty list here, which
  -- may not gain much, we'd use case statements in reality, or  
we'd
  -- catch failure within the monad, which is also safe-- 
provided you
  -- catch them, which the language doesn't force you to do!  
(Or if

  -- we're in a pure monad like Maybe.)
  NotNull <- nullL cs'
  let c = headL cs'
  t = tailL cs'
  -- Now to illustrate the power of the GADT, a line that  
will fail

  -- at compile time:
  t' = tailL t
  return c

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


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


Re: [Haskell-cafe] Looking for documentation on Control.Parallel.Strategies

2007-02-16 Thread Pepe Iborra
There is also an excellent paper in tutorial style which imho is very  
useful to understand the interaction of lazyness with the  
Control.Parallel.Strategies combinators:


"Algorithm + Strategy = Parallelism"
Philip W. Trinder, Kevin Hammond, Hans-Wolfgang Loidl, and Simon L.  
Peyton Jones. Journal of Functional Programming, 8(1), Jan 1998.

http://www.macs.hw.ac.uk/~dsg/gph/papers/abstracts/strategies.html



On 16/02/2007, at 22:44, Jefferson Heard wrote:


That's MUCH better, thanks.  That's not what's directly available from
haskell.org.  It still doesn't give anything more general about  
using the
combinators in actual programs, you know, like examples, but it's  
at least

some clear documentation as to what each strategy does.

Maybe one day, when I have a parallel program actually working, I  
could

document that...

On Friday 16 February 2007 16:26, Bjorn Bringert wrote:

On Feb 16, 2007, at 21:16 , Jefferson Heard wrote:

Is there anything that documents this further than the Haddock
documentation
available from Haskell.org or the GHC pages?  I've gotten some basic
parallelism to work using parMap and using >|| and >|, but I had a
fold and a
map that I could logically compute at the same time.

...


Maybe that's what you're looking at, but the darcs version has some
more Haddock comments, see http://www.haskell.org/ghc/dist/current/
docs/libraries/base/Control-Parallel-Strategies.html

/Björn

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


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


Re: [Haskell-cafe] Space Leak Help

2007-02-03 Thread Pepe Iborra

hi Dominic

Explicit recursion works just fine for me and keeps things simple:

pad :: [Word8] -> [Word8]
pad xs = pad' xs 0

pad' (x:xs) l = x : pad' xs (succ l)
pad' [] l = [0x80] ++ ps ++ lb
   where
  pl = (64-(l+9)) `mod` 64
  ps = replicate pl 0x00
  lb = i2osp 8 (8*l)


at the cost of (very slightly) hiding data flow.
Seems exactly what you were trying to avoid?

Cheers
pepe


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


Re: [Haskell-cafe] ST and Transformers

2006-12-22 Thread Pepe Iborra

Hi J Garrett,

I don't see any problem in GHC 6.6. with:

> runTest c = runST (runErrorT c)

*Main> runTest (return True)
Loading package mtl-1.0 ... linking ... done.
Right True
*Main>


On the other hand, I try to define it firstly as below and got the  
following error.


> runTest = runST . runErrorT

Couldn't match expected type `forall t. Test t r'
   against inferred type `ErrorT e m a'
  Expected type: (forall t. Test t r) -> forall s. ST s a1
  Inferred type: ErrorT e m a -> m (Either e a)
In the second argument of `(.)', namely `runErrorT'
In the expression: runST . runErrorT


Rank-2 types seem to interact badly with (.) and ($), but my type  
theory educated neuron doesn't know why. I think this is folklore  
knowledge?


Cheers
pepe

On 22/12/2006, at 18:26, J. Garrett Morris wrote:


Hello everyone,

I recently found myself attempting to use ST at the base of a stack of
transformers, ala:

type Test t r = ErrorT String (ST t) r

I imagined, given the type of ST, that I would need a run function
along the lines of:

runTest :: (forall t. Test t r) -> Either String r

(which was, in fact, exactly what I wanted).  Unfortunately, even with
that type signature, I can't find a way to convince the compiler that
the state thread is properly universal in the call to runST.  Is it
possible to write this function, or is ST (and other monads that use
its style of threading) not transformable?

Thanks,
/g

--
It is myself I have never met, whose face is pasted on the  
underside of my mind.

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


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


Re: [Haskell-cafe] Composing monads (sort of)

2006-12-16 Thread Pepe Iborra

Wait, there are two monads in scene here, IO and Maybe.
The right solution is to compose them indeed. One could use the  
MaybeT monad transformer defined in the 'All about monads' tutorial 
[1], or we could just define the IOmaybe monad:


> import Data.Traversable (mapM)
>
> newtype IOMaybe a = IOM { iom :: IO (Maybe a) }
>
> instance Monad IOMaybe where
> return = IOM . return . Just
> c >>= f = IOM$ do
>mb_v <- iom c
>mapM (iom.f) mb_v >>= return . join

Now we can define:

> t1 = IOM . return . f1
> t2 = IOM . f2
> t3 = IOM . return . f3
> traverse rec1 = t1 rec1 >>= t2 >>= t3

And this scheme lends itself very well to define any kind of traversal.
Note that I used the more general version of mapM defined in  
Data.Traversable in the definition of the (>>=) combinator. A more  
conventional definition is given the 'All about monads' tutorial.


Cheers
pepe

1- http://www.nomaware.com/monads/html/index.html

On 16/12/2006, at 15:35, Chris Eidhof wrote:


Hey Mark,

How can I concisely compose these functions without having to  
write a cascade of case statements such as:


case f1 rec1 of
Nothing -> return Nothing
Just id1 -> do
rec2 <- f2 id2
return $ case rec2 of
Nothing -> return Nothing
Just rec2' -> case f3 rec2' of

I understand that if I was just dealing with Maybe I could use the  
fact that Maybe is a monad.

Yes, you can write like this:


id2 <- f1 rec1
rec2 <- f2 id2
rec3 <- f3 rec2
return rec3

or, even shorter:

id2 <- f1 rec1
rec2 <- f2 id2
f3 rec2


The cool thing of the Maybe monad is that it combines a result in  
such a way that it removes the plumbing of constantly checking for  
Nothing. I can definitely recommand you the following tutorials:


http://www.nomaware.com/monads/html/index.html
http://uebb.cs.tu-berlin.de/~magr/pub/Transformers.en.html

Those two tutorials really helped me.

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


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


Re: [Haskell-cafe] Refactoring recklessly

2006-12-12 Thread Pepe Iborra


On 12/12/2006, at 20:31, Alec Berryman wrote:


Greg Fitzgerald on 2006-12-12 11:24:58 -0800:

I'd like to be able to reorganize my code and then verify that I  
didn't
change any functionality.  That is, the old and new code have  
precisely the

same meaning.

Also, I'd like to be able to change a function and verify that  
efficiency

was the only thing affected.

Are either of these possible in Haskell or any language?


Use QuickCheck to generate parameters and compare return values for  
the

old and the new functions.



That is a great suggestion which works extremely well in my  
experience, but only for the second of Greg's requests.
In the first case you don't need the additional validation, and  
probably you don't want to keep your unrefactored code around.



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


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


Re: [Haskell-cafe] Command line utility that shrinks/simplifies functions applications ?

2006-11-30 Thread Pepe Iborra


On 30/11/2006, at 17:04, Spencer Janssen wrote:

I believe you're talking about the `pl' plugin for lambdabot.   
Lambdabot has an offline mode, visit the homepage for the source:

http://www.cse.unsw.edu.au/~dons/lambdabot.html

There is also a web interface to lambdabot, but I can't seem to  
find the link.


http://lambdabot.codersbase.com/

It's really nice, I use it all the time.___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: [Haskell] ANNOUNCE: Visual Haskell prerelease 0.2

2006-11-28 Thread Pepe Iborra


On 28/11/2006, at 12:25, Krasimir Angelov wrote:


On 11/28/06, Johannes Waldmann <[EMAIL PROTECTED]> wrote:

seriously, how hard would it be to adapt VH to Eclipse?
the interfaces (for syntax highlighting, typechecking etc.)
should be similar - in theory.




Parsing and typechecking in VH is all done by GHC via the ghc-api.  
Thus strong interoperability support is needed.



Ah, and about Eclipse. Visual Studio and Eclipse are very different
platforms and you have to rewrite VSHaskell almost from scratch if you
want an Eclipse port. Perhaps the only common parts will be Cabal &
GHC.



Not only the interfaces are completely different, but an entirely new  
set of interoperability problems would need to be solved. The guys  
from EclipseFP have a document[1] about that topic.



That said I would love being able to run an eclipsified VH in my Mac :)

[1] - http://eclipsefp.sourceforge.net/haskell/ 
ExtendingEclipseInHaskell.pdf


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


Re: [Haskell-cafe] Foldl

2006-11-24 Thread Pepe Iborra

On 24/11/2006, at 22:27, Marco Comini wrote:



On the contrary a solution in terms of a fold is indeed more  
tricky. Probably ClareZako was actually looking for a solution in  
term of a scan instead of a fold... otherwise would be interesting  
to know why he's willing to solve this problem in such a twisted  
way... don't you agree?




It's clear to me

http://www.cse.unsw.edu.au/~dons/haskell-1990-2006/msg13946.html
http://www.haskell.org/haskellwiki/Homework_help

I only hope this was not Marco's student. Or was it? :) 
___

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


Re: [Haskell-cafe] Haskell Debugging

2006-11-13 Thread Pepe Iborra
Can you manage to compile GHC under Windows? Compiling GHC under  
Windows is known to be a bit tricky and time consuming, certainly not  
for the novice user, although the steps are well detailed in the GHC  
developer documentation.


If so, I'd encourage you to play with the Ghci Debugger project. But  
beware, it is still in an experimental phase and there are some  
pending issues.


If you want to try it I have set up the repository to point to the  
"last good known" version I have around.  Just follow the  
instructions on how to get the patches in the wiki page.



Otherwise, I'd advise you to stick to Debug.Trace and friends.

Cheers
pepe

On 13/11/2006, at 17:29, Valentin Gjorgjioski wrote:


On 13.11.2006 16:54 Valentin Gjorgjioski wrote:

On 13.11.2006 16:48 Pepe Iborra wrote:

Hi Valentin

Please, take a look at the Haskell Wiki page for debugging.

http://haskell.org/haskellwiki/Debugging

You will find that thanks to Neil Mitchell there is a Windows  
version of Hat available. Perhaps you can add your experiences  
with it if it works for you.


Oh silly me, I was looking that page, but I didn't notice this.  
Thanks a lot, pepe.

I'll try, and I'll post feedback here.


I install it, I tried it, and it doesn't work for me.

./Hat/DML.hs:535:66:
  Ambiguous type variable `a' in the constraint:
`Integral a' arising from use of `*^' at ./Hat/DML.hs:535:66-69
  Probable fix: add a type signature that fixes these type variable(s)

And this is line 535
T.uapp2 p125v94v125v148 p125v147v125v147 p (+^) (*^)

After that, I have in my code used operator ^, and I deleted that  
operator. Program finally compiled, but now, hat-observe reports me  
an error... this program has encountered a problem


So, I will be really happy with something simple as Hugs.Observe if  
it works with floats. Some recommendation please?

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


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


Re: [Haskell-cafe] Haskell Debugging

2006-11-13 Thread Pepe Iborra

Hi Valentin

Please, take a look at the Haskell Wiki page for debugging.

http://haskell.org/haskellwiki/Debugging

You will find that thanks to Neil Mitchell there is a Windows version  
of Hat available. Perhaps you can add your experiences with it if it  
works for you.


pepe

On 13/11/2006, at 16:32, Valentin Gjorgjioski wrote:

I'm pretty new in Haskell, few days since I started learning it. I  
want to debu my programs. I'm currently using WinHugs, and I prefer  
debugger for this.


I tried googling and I found Hugs.Observer.

I like it how it works, but still I have one BIG problem with it.  
It doesn't work well with floats.


Following example

import Hugs.Observe

ex8 :: [Float]
ex8 = (observe "after reverse" ) reverse  [10.0,7.0,3.0,0.0,4.0]

gives me

>ex8
[4.0,0.0,3.0,7.0,10.0]

>>> Observations <<

after reverse
  { \ ($-990871 : $-990888 : $-990905 : $-990922 : $-990939 : [])  - 
> $-990939 : $-990922 : $-990905 : $-990888 : $-990871 : []

  }

Which is not useful. After that I try to install

http://www.haskell.org/hat/

but for installing that I need hmake, and when I try to install  
hmake, I typed first configure -prefix, and then, make.


cd src/hmake;  make HC=ghc BUILDCOMP=ghc all config
make[1]: Entering directory `/cygdrive/E/Haskell/hmake/src/hmake'
Makefile:59: *** target pattern contains no `%'.  Stop.
make[1]: Leaving directory `/cygdrive/E/Haskell/hmake/src/hmake'
make: *** [targets/ix86-CYGWIN_NT-5.1/hmake-ghc] Error 2

as you can see I'm using cygwin.

I'm really stacked here, and I will kindly ask for help.


Thanks,
Valentin


--
Valentin Gjorgjioski
Bachelor of Computer Science
Department of Knowledge Technologies, Jozef Stefan Institute
Jamova 39, SI-1000 Ljubljana, Slovenia
Phone:  +386 1 477 3343
Fax:+386 1 477 3315
Web:http://kt.ijs.si/ValentinGjorgjioski/
Email:  [EMAIL PROTECTED]
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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


Re: [Haskell-cafe] Sistema de Ecuaciones NO lineales

2006-11-09 Thread Pepe Iborra

hi Sebastian

I think that it would be more appropriate to use english when you  
post to this particular list.
On non linear equations or jacobi, I'm sorry but I cannot help you.  
But hopefully someone else in this list may be able to.


Saludos.
Cheers.
pepe.

On 09/11/2006, at 4:52, Sebastian Gaviria wrote:


hola como estan

Quiero preguntar quien puede resolver el sistemas de ecuaciones NO  
lineales de Newton y el codigo de Jacobi  en Haskell


me ayudarian mucho al poder implementar ese codigo

por Favor es con urgencia tener estos codigos!!


muchas gracias !!!

--

"La sociedad debe juzgarse por su capacidad para hacer que la gente  
sea feliz.""


SEBASTIAN GAVIRIA J.
INGENIERIA SISTEMAS
UNIVERSIDAD EAFIT
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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


Re: [Haskell-cafe] Howto Haskell in PocketPC?

2006-10-14 Thread Pepe Iborra
This has been around for some time already. It used to work with  
PPC2003, hopefully it'll still do:


http://www.comp.nus.edu.sg/~luzm/ppchugs/

Enjoy it :)

On 14/10/2006, at 8:24, Iván Pérez Domínguez wrote:


Hi.

Here a simple question: Is there any haskell compiler/interpreter or
similar for PocketPC?
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


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


Re: [Haskell-cafe] how do you debug programs?

2006-09-07 Thread Pepe Iborra


On 07/09/2006, at 10:53, Tamas K Papp wrote:



Dear Pepe,

Thank you for the information.  I finally ended up working with
Debug.Trace, and found the bug very quickly.  I also tried Hood, but
couldn't load it in ghci: import Observe can't find the library, but

% locate Observe
/usr/lib/ghc-6.4.2/hslibs-imports/util/Observe.hi
/usr/lib/ghc-6.4.2/hslibs-imports/util/Observe.p_hi
/usr/lib/hugs/libraries/Hugs/Observe.hs
/usr/lib/hugs/oldlib/Observe.hs

Does importing from hslibs-imports require something special?


Hi Tamas

I'm glad to hear that you fixed it!

GHC includes Observe (the hs-libs-imports file you are seeing) only  
in the hidden 'util' package, which I believe is deprecated or not  
present in 6.6. If you want to use it, launch ghci with the flag '- 
package util'.
Or download Observe.hs from the Hood website and place it somewhere  
in the path.


Hmm, it would be handy to have a Cabal Hood package...

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


Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Pepe Iborra
On 06/09/2006, at 17:10, Andrae Muys wrote:On 06/09/2006, at 8:22 PM, Neil Mitchell wrote:It's been my experience that debugging is a serious weakness ofHaskell - where even the poor mans printf debugging changes thesemantics! And everyone comes up with arguments why there is no needto debug a functional language - that sounds more like excuses aboutwhy we can't build a good lazy debugger :)[Sorry for the slight rant, but I've used Visual Studio C++ so I knowwhat a good debugger looks like, and how indispensable they are]I simply can't let this pass without comment.  It's irrelevant if you're using a functional or imperative language, debuggers are invariably a waste of time.  The only reason to use a debugger is because you need to inspect the contents of a processes address-space; so either you're using it as a disassembler, or you're using it to examine the consequences of heap/stack corruption.  Consequently, if you're using Java, C#, Scheme, Haskell, Erlang, Smalltalk, or any one of a myriad of languages that don't permit direct memory access, there's no reason for you to be using a debugger.Jon understates it by implying this is a Functional/Haskell specific quality - it's not.  Debuggers stopped being useful the day we finally delegated pointer handling to the compiler/vm author and got on with writing code that actually solves real problems.You seem to base everything on the assumption that a debugger is a program that lets you, and I quote your words below, "trace through individual lines of code".A debugger in the sense that this post regards it is any kind of program that helps you to understand a piece of code. A debugger is the program that tries to answer the following questions:"What information can we provide to the programmers about how a program is running?""What information will help the programmer most?"If it happens that traditionally debuggers are based in inspecting the memory, this is an unavoidable situation considering the history of programming languages. But certainly there are many other possibilities that can help a programmer to manage the complexity of a running program, and it seems as if you disregard them all completely in your argument !It's just that historically functional programmers have tended to already be experienced programmers who realise this.  Why would they waste their time building a tool that no-one needs?This whole block is offensive to the rest of the world. Fortunately it has nothing to do with reality: - the recent GHC survey uncovered "some kind of debugger" as the most demanded tool - Other functional languages have seen magnificent efforts in the debugging camp, such as the awesome Ocaml debugger or the now sadly defunct ML Time-Travel debugger from A. Tolmach - The Lispish languages, which are arguably on the functional side too, have always  enjoyed impressive online debugging tools.It's a truism to say if your code doesn't work it's because you don't understand it; clearly if you did understand it, you wouldn't have included the bug that's causing you difficulty.Therefore either1) The code is poorly structured and you need to restructure it to better represent your understanding of the problemor2) Your understanding of the problem is flawed, so you need to sit back and reexamine your thinking on this problem in light of the counter-example you have found (the bug).Spending your time tracing through individual lines of code is counter-productive in both cases.Andrae MuysP.S. It is worth noting that I am here talking about the sort of debugger raised in the original post.  I am not talking about using a separate tool to extract a stracktrace from a core file in a C/C++ program or equivalent - I'm talking about runtime debugging with variable watches, breakpoints, and line-by-line stepping. -- Andrae Muys[EMAIL PROTECTED]Principal Kowari ConsultantNetymon Pty Ltd ___Haskell-Cafe mailing listHaskell-Cafe@haskell.orghttp://www.haskell.org/mailman/listinfo/haskell-cafe ___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: how do you debug programs?

2006-09-06 Thread Pepe Iborra

Here's another story.

A few weeks ago I was working on dynamic breakpoints for GHC. At that  
moment, I was trying to capture the bindings introduced by implicit  
parameters in the type of a function, in order to make them available  
at a breakpoint site.


Ok, disregard the stuff about me working on dynamic breakpoints. It  
is completely orthogonal to what I'm trying to convey here.


So, in order to capture these bindings, I had to introduce some code  
in dsBinds, the function that munches type constraints in the GHC  
desugarer. Or was it...? Doh, I don't even remember accurately and it  
was only a few days ago.


The problem is that this function would build on a lot of  
abstractions below it, particularly on a datatype called HsBind.  
There were some comments located near the datatype definition trying  
to give some insight about its meaning, but they were almost  
completely opaque to me. Even more, they referred to a paper, the one  
about Static Semantics of Haskell, which, even if interesting, was  
discouragingly long.


I was faced with the disjunctive of trying to completely understand  
the whole thing, or be more pragmatic and handle only the cases  
specific to my problem. A few traces showing me the structure  
received at dsBinds were incredibly productive: in a few minutes I  
was ready to test my solution.


The morale of the story is, imho, that sometimes the problem is not  
Haskell, the language; or C, the language. The problem is complexity  
and the size of the programs we are dealing with. It can easily be  
the case that you are dealing with code written by another person and  
you cannot afford the time necessary to completely understand its  
insides.


A good debugger may be counterproductive for issues in your own code,  
but it can be immensely helpful in a myriad other situations.


Cheers
pepe

On 06/09/2006, at 16:39, Jón Fairbairn wrote:


Here's a story:

A long time ago, when I was an undergraduate, I encountered
a visitor to the Computing Service who often asked for help
with the idiosyncrasies of the local system. I was happy to
help, though somewhat bemused by all the muttering at his
terminal while he was programming, which involved some sort
of debugging, for sure.  After some weeks he finished his
programme and whatever kept him in Cambridge and
disappeared.  Being curious, I dug (strictly against
regulations) a listing of his programme out of the scrap
bin. It was in PL/I, and several millimetres thick. It took
me quite a while (hours, though, not weeks) to work out what
the programme did, but eventually I understood it well
enough that I could write a version in Algol68 (my favourite
language at the time).  It came to one sheet of listing
paper.  This wasn't because A68 is more expressive than PL/I
(it is, but not by that much), it was because I understood
the problem before I started to write the code.

Now, you could argue that the first programmer spent most of
his time working out what the problem was (it might even be
true, but given that it boiled down to 1 page of A68, I'm
not sure), but my point is that if you proceed by debugging
rather than rewriting, you are likely to end up with this
sort of mess. Personally, I don't mind too much if that kind
of programmer finds Haskell too hard. Elitist? Certainly!
Immorally so? No.


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


Re: [Haskell-cafe] how do you debug programs?

2006-09-06 Thread Pepe Iborra

Thanks for the suggestion Don,

I started the wiki page at http://haskell.org/haskellwiki/Debugging

On 06/09/06, Donald Bruce Stewart <[EMAIL PROTECTED]> wrote:

mnislaih:
> Hi Tamas
>
> There are several ways to debug a Haskell program.
>
> The most advanced ones are based in offline analysis of traces, I
> think Hat [1] is the most up-to-date tool for this. There is a Windows
> port of Hat at [5].
>
> Another approach is to simply use Debug.Trace. A more powerful
> alternative for this approach is Hood [2]. Even if it hasn't been
> updated in some time, Hood works perfectly with the current ghc
> distribution. Even more, Hugs has it already integrated [3]. You can
> simply import Observe and use observations directly in your program.
> For instance:
>
> import Observe
>
> f' = observe "f" f
> f a b = 
>
> And then in hugs the expression:
> >f' 1 2
>
> would output what you want.
>
> Finally, the GHCi debugger project [4] aims to bring dynamic
> breakpoints and intermediate values observation to GHCi in a near
> future. Right now the tool is only available from the site as a
> modified version of GHC, so unfortunately you will have to compile it
> yourself if you want to try it.

Pepe, would you like to put up a page on the haskell.org wiki about
debugging in Haskell? You could use the above mail as a start :)

-- Don





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


Re: [Haskell-cafe] how do you debug programs?

2006-09-06 Thread Pepe Iborra

Hi Tamas

There are several ways to debug a Haskell program.

The most advanced ones are based in offline analysis of traces, I
think Hat [1] is the most up-to-date tool for this. There is a Windows
port of Hat at [5].

Another approach is to simply use Debug.Trace. A more powerful
alternative for this approach is Hood [2]. Even if it hasn't been
updated in some time, Hood works perfectly with the current ghc
distribution. Even more, Hugs has it already integrated [3]. You can
simply import Observe and use observations directly in your program.
For instance:

import Observe

f' = observe "f" f
f a b = 

And then in hugs the expression:

f' 1 2


would output what you want.

Finally, the GHCi debugger project [4] aims to bring dynamic
breakpoints and intermediate values observation to GHCi in a near
future. Right now the tool is only available from the site as a
modified version of GHC, so unfortunately you will have to compile it
yourself if you want to try it.

Cheers
pepe


1. www.haskell.org/hat
2. www.haskell.org/hood
3. http://cvs.haskell.org/Hugs/pages/users_guide/observe.html
4. http://haskell.org/haskellwiki/GHC/GHCiDebugger
5. http://www-users.cs.york.ac.uk/~ndm/projects/windows.php

On 06/09/06, Tamas K Papp <[EMAIL PROTECTED]> wrote:

Hi,

I would like to learn a reasonable way (ie how others do it) to debug
programs in Haskell.  Is it possible to "see" what's going on when a
function is evaluated?  Eg in

f a b = let c = a+b
d = a*b
in c+d

evaluating

f 1 2

would output something like

f called with values 1 2
c is now (+) a b => (+) 1 2 => 3
d is now (*) a b => (*) 1 2 => 2
...

Or maybe I am thinking the wrong way, and functional programming has
its own debugging style...

Thanks,

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


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


Re: Re[2]: [Haskell-cafe] Why Haskell?

2006-07-23 Thread Pepe Iborra

Bulat,  now that Krasimir has resumed work on Visual Haskell, I have
planned to pursue an integration of the ghc-api debugger with Visual
Haskell as soon as possible.
But as we get closer to having dynamic breakpoints working 100%, the
plain ghci debugging support starts to look as a fairly nice addition
to anyone's ghc toolkit.
Of course, I agree with you that it's too early to recommend it for real work.

On 23/07/06, Bulat Ziganshin <[EMAIL PROTECTED]> wrote:

Hello Pepe,

Sunday, July 23, 2006, 5:23:18 PM, you wrote:

>> 1) Lack of debugging support.  Yes there are print statements and trace,

> You can find more info about this project in the Haskell wiki at:
>  http://haskell.org/haskellwiki/Ghci/Debugger

> All you'd need to do is to compile ghc-6.5 with a few patches (if you
> are in Windows you can use MinGW). But I am afraid you are right, this
> is a work in progress and we are in the process of polishing some
> serious issues right now. I can't really recommend it for now.

is this will be really usable without gui support? your project is
really great, but i think it's too early to recommend it for real work
(as opposite to hacking/integration with IDEs)


--
Best regards,
 Bulatmailto:[EMAIL PROTECTED]



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


Re: [Haskell-cafe] Why Haskell?

2006-07-23 Thread Pepe Iborra

1) Lack of debugging support.  Yes there are print statements and trace,
but I would like to set a breakpoint.  It would be nice to do so and
launch the GHCi interpreter with all the variable context supported.  A
google search revealed that there is current work on this, but
unfortunately the package is in cabal, which has spotty support in
windows it seems.


You can find more info about this project in the Haskell wiki at:
http://haskell.org/haskellwiki/Ghci/Debugger

All you'd need to do is to compile ghc-6.5 with a few patches (if you
are in Windows you can use MinGW). But I am afraid you are right, this
is a work in progress and we are in the process of polishing some
serious issues right now. I can't really recommend it for now.

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


[Haskell-cafe] Google SoC

2006-04-21 Thread Pepe Iborra
http://code.google.com/soc/

This is not news. SoC was presented a few days ago, and by now there are a 
lot of projects available, yet none(?) Haskell related :(
This is a plea for Haskell FOSS project managers to apply as mentor 
organizations, so that we students can have a choice.
Surely there are a lot of contributions that can be tackled by a motivated 
student in three months time. GHC related stuff, work in Visual Haskell, 
tasks in a given Haskell framework, Darcs stuff, you name it.

Deadline for mentor organizations is May 1, but they might close it earlier 
if they get their hands full.

pep 



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


[Haskell-cafe] Re: EclipseFP (Haskell IDE) 0.9.1 released

2006-02-07 Thread Pepe iborra
"Graham Klyne" <[EMAIL PROTECTED]> escribió en el mensaje 
news:[EMAIL PROTECTED]
>
> One of the features of Haskell that I like is that it doesn't require lots 
> of
> IDE support to write complex programs... the compact syntax and clean 
> separation
> of concerns that can be achieved make it iasy enough to program using 
> nothing
> more than a regular text editor, and no long wait for the development
> environment to start up.  I can imagine programming Haskell on a palm-top 
> device.

I do that on my PDA phone sometimes, usually when I'm having a coffee with 
some buddy discussing this or that algorithm :)
Thanks to whoever ported Hugs for Windows CE (I don't remember the url now) 



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