Re: [Haskell-cafe] Building Plaftorm 2010 2 on 64bit Linux

2011-02-10 Thread Dušan Kolář

Well, that was probably the main problem :-(

Unfortunately, even if, after performing all the stuff once again, I 
made platform configured, make ended in compilation of happy with old 
story:


Configuring happy-1.18.5...
./Setup build
Preprocessing executables for happy-1.18.5...
Building happy-1.18.5...
ghc: could not execute: /usr/bin/gcc

Error:
Building the happy-1.18.5 package failed
make: *** [build.stamp] Error 2


Even if all other items went OK, until happy :-(  and it is called happy 
;-) :-D



Dusan


On 02/08/2011 04:48 PM, Christian Maeder wrote:

What does gcc -v say?

Maybe you have to install the 32Bit ghc-6.12.3 that can work together
with your gcc.

Christian

Am 08.02.2011 15:05, schrieb Kolar Dusan:

No :-(

D.



There seems to be confusion about 32bit and 64bit assembly.
Can you compile and link without optimization?

C.

Am 08.02.2011 13:33, schrieb Dušan Kolář:

Well, it helped, but not getting output anyway:

/tmp/ghc32376_0/ghc32376_0.s: Assembler messages:

/tmp/ghc32376_0/ghc32376_0.s:35:0:
  Error: bad register name `%rbp)'

/tmp/ghc32376_0/ghc32376_0.s:36:0:  Error: bad register name `%r15'

/tmp/ghc32376_0/ghc32376_0.s:38:0:  Error: bad register name `%r12'

/tmp/ghc32376_0/ghc32376_0.s:39:0:
  Error: bad register name `%r13)'

/tmp/ghc32376_0/ghc32376_0.s:41:0:
  Error: bad register name `%r12)'

/tmp/ghc32376_0/ghc32376_0.s:42:0:  Error: bad register name `%rbx'


... and many other similar lines


Is my installation of gcc broken? :-O


___
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] Building Plaftorm 2010 2 on 64bit Linux

2011-02-10 Thread Dušan Kolář

I have the following ghc script:

cat ghc
#!/bin/sh
exedir=/usr/local/lib/ghc-6.12i386/lib/ghc-6.12.3
exeprog=ghc-stage2
executablename=$exedir/$exeprog
datadir=/usr/local/lib/ghc-6.12i386/share
bindir=/usr/local/lib/ghc-6.12i386/bin
topdir=/usr/local/lib/ghc-6.12i386/lib/ghc-6.12.3
pgmgcc=/usr/local/bin/gcc
executablename=$exedir/ghc
exec $executablename -B$topdir -pgmc $pgmgcc  -pgml $pgmgcc 
-pgma $pgmgcc  ${1+$@}


Dušan

On 02/10/2011 04:38 PM, Christian Maeder wrote:

Am 10.02.2011 13:15, schrieb Dušan Kolář:

Well, that was probably the main problem :-(

Unfortunately, even if, after performing all the stuff once again, I
made platform configured, make ended in compilation of happy with old
story:

Configuring happy-1.18.5...
./Setup build
Preprocessing executables for happy-1.18.5...
Building happy-1.18.5...
ghc: could not execute: /usr/bin/gcc

Error:
Building the happy-1.18.5 package failed
make: *** [build.stamp] Error 2

Maybe this time indeed gcc is called as linker and you should add
  -pgml /usr/local/bin/gcc

In fact my ghc script for ghc-7.0.1 contains:

pgmgcc=/usr/bin/gcc
executablename=$exedir/ghc
exec $executablename -B$topdir -pgmc $pgmgcc -pgma $pgmgcc -pgml
$pgmgcc -pgmP $pgmgcc -E -undef -traditional ${1+$@}

Christian



Even if all other items went OK, until happy :-(  and it is called happy
;-) :-D


Dusan


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


[Haskell-cafe] Building Plaftorm 2010 2 on 64bit Linux

2011-02-08 Thread Dušan Kolář

Hello all,

  I'm trying to build platform on Linux 2.6.32.22 #1 SMP Tue Sep 21 
09:44:04 CEST 2010 x86_64 x86_64 x86_64 GNU/Linux. I've downloaded 
binary of ghc6.12.3 for the purpose, but ghc doesn't work. ghci does 
work, gcc does work, but for ghc I get:


ghc -O2 --make test.hs -o test
[1 of 1] Compiling Main ( test.hs, test.o )
ghc: could not execute: /usr/bin/gcc

Even if I can easily compile gcc testc.c -o testc and run testc.

Could anyone point me to a solution? Helps found by google pointed me to 
try use option -pgmc gcc, which doesn't work. All other threads with 
similar issue stayed unresoleved. :-(


Thanks

   Dusan


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


Re: [Haskell-cafe] Building Plaftorm 2010 2 on 64bit Linux

2011-02-08 Thread Dušan Kolář

Not the problem, ghc script:

cat /usr/local/lib/ghc-6.10.4/V12/bin/ghc
#!/bin/sh
exedir=/usr/local/lib/ghc-6.10.4/V12//lib/ghc-6.12.3
exeprog=ghc-stage2
executablename=$exedir/$exeprog
datadir=/usr/local/lib/ghc-6.10.4/V12/share
bindir=/usr/local/lib/ghc-6.10.4/V12/bin
topdir=/usr/local/lib/ghc-6.10.4/V12/lib/ghc-6.12.3
pgmgcc=/usr/local/bin/gcc
executablename=$exedir/ghc
exec $executablename -B$topdir -pgmc $pgmgcc ${1+$@}

while:

which gcc
/usr/local/bin/gcc


Dusan


On 02/08/2011 12:42 PM, Christian Maeder wrote:

Am 08.02.2011 11:39, schrieb Dušan Kolář:

ghc -O2 --make test.hs -o test
[1 of 1] Compiling Main ( test.hs, test.o )
ghc: could not execute: /usr/bin/gcc

Even if I can easily compile gcc testc.c -o testc and run testc.

Your ghc script (under /usr/local/bin or elsewhere type -all ghc)
contains a line:

   pgmgcc=/usr/bin/gcc

This line should be corrected to point to your gcc that is probably not
under /usr/bin/. Try by which gcc or type -all gcc.

(The official binaries only work for sane systems.)

HTH Christian


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


Re: [Haskell-cafe] Building Plaftorm 2010 2 on 64bit Linux

2011-02-08 Thread Dušan Kolář

Unfortunately, no help :-(

String /usr/bin/gcc was found in the following files, if it is useful 
information:


/lib/ghc-6.12.3/haddock
/lib/ghc-6.12.3/ghc

/lib/ghc-6.12.3/ghc-6.12.3/Config.hi
/lib/ghc-6.12.3/ghc-6.12.3/Config.p_hi
/lib/ghc-6.12.3/ghc-6.12.3/Config.dyn_hi
/lib/ghc-6.12.3/ghc-6.12.3/libHSghc-6.12.3.a
/lib/ghc-6.12.3/ghc-6.12.3/libHSghc-6.12.3_p.a
/lib/ghc-6.12.3/ghc-6.12.3/HSghc-6.12.3.o
/lib/ghc-6.12.3/ghc-6.12.3/libHSghc-6.12.3-ghc6.12.3.so

+doc files

Dusan


On 02/08/2011 12:56 PM, Christian Maeder wrote:

Ok, gcc is used as linker, too. So maybe try to

   -pgml /usr/local/bin/gcc

add to your command line.

C.

Am 08.02.2011 12:50, schrieb Dušan Kolář:

Not the problem, ghc script:

cat /usr/local/lib/ghc-6.10.4/V12/bin/ghc
#!/bin/sh
exedir=/usr/local/lib/ghc-6.10.4/V12//lib/ghc-6.12.3
exeprog=ghc-stage2
executablename=$exedir/$exeprog
datadir=/usr/local/lib/ghc-6.10.4/V12/share
bindir=/usr/local/lib/ghc-6.10.4/V12/bin
topdir=/usr/local/lib/ghc-6.10.4/V12/lib/ghc-6.12.3
pgmgcc=/usr/local/bin/gcc
executablename=$exedir/ghc
exec $executablename -B$topdir -pgmc $pgmgcc ${1+$@}

while:

which gcc
/usr/local/bin/gcc


Dusan


On 02/08/2011 12:42 PM, Christian Maeder wrote:

Am 08.02.2011 11:39, schrieb Dušan Kolář:

ghc -O2 --make test.hs -o test
[1 of 1] Compiling Main ( test.hs, test.o )
ghc: could not execute: /usr/bin/gcc

Even if I can easily compile gcc testc.c -o testc and run testc.

Your ghc script (under /usr/local/bin or elsewhere type -all ghc)
contains a line:

pgmgcc=/usr/bin/gcc

This line should be corrected to point to your gcc that is probably not
under /usr/bin/. Try by which gcc or type -all gcc.

(The official binaries only work for sane systems.)

HTH Christian


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


Re: [Haskell-cafe] Building Plaftorm 2010 2 on 64bit Linux

2011-02-08 Thread Dušan Kolář

This is the end of the log:

*** Assembler:
/usr/bin/gcc -I. -c /tmp/ghc29474_0/ghc29474_0.s -o test.o
*** Deleting temp files:
Deleting: /tmp/ghc29474_0/ghc29474_0.s
*** Deleting temp dirs:
Deleting: /tmp/ghc29474_0
ghc: could not execute: /usr/bin/gcc

Otherwise gcc not mentioned, no error mentioned.

Dusan


On 02/08/2011 01:04 PM, Christian Maeder wrote:

Does adding -v reveal when /usr/bin/gcc is used?

   ghc -v -O2 --make test.hs -o test

C.

Am 08.02.2011 11:39, schrieb Dušan Kolář:

Hello all,

   I'm trying to build platform on Linux 2.6.32.22 #1 SMP Tue Sep 21
09:44:04 CEST 2010 x86_64 x86_64 x86_64 GNU/Linux. I've downloaded
binary of ghc6.12.3 for the purpose, but ghc doesn't work. ghci does
work, gcc does work, but for ghc I get:

ghc -O2 --make test.hs -o test
[1 of 1] Compiling Main ( test.hs, test.o )
ghc: could not execute: /usr/bin/gcc

Even if I can easily compile gcc testc.c -o testc and run testc.

Could anyone point me to a solution? Helps found by google pointed me to
try use option -pgmc gcc, which doesn't work. All other threads with
similar issue stayed unresoleved. :-(

Thanks

Dusan


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


Re: [Haskell-cafe] Building Plaftorm 2010 2 on 64bit Linux

2011-02-08 Thread Dušan Kolář

Well, it helped, but not getting output anyway:

/tmp/ghc32376_0/ghc32376_0.s: Assembler messages:

/tmp/ghc32376_0/ghc32376_0.s:35:0:
 Error: bad register name `%rbp)'

/tmp/ghc32376_0/ghc32376_0.s:36:0:  Error: bad register name `%r15'

/tmp/ghc32376_0/ghc32376_0.s:38:0:  Error: bad register name `%r12'

/tmp/ghc32376_0/ghc32376_0.s:39:0:
 Error: bad register name `%r13)'

/tmp/ghc32376_0/ghc32376_0.s:41:0:
 Error: bad register name `%r12)'

/tmp/ghc32376_0/ghc32376_0.s:42:0:  Error: bad register name `%rbx'


... and many other similar lines


Is my installation of gcc broken? :-O


Dusan


On 02/08/2011 01:27 PM, Christian Maeder wrote:

This looks like gcc is used as assembler.

Try to add:

   -pgma /usr/local/bin/gcc

C.


Am 08.02.2011 13:22, schrieb Dušan Kolář:

This is the end of the log:

*** Assembler:
/usr/bin/gcc -I. -c /tmp/ghc29474_0/ghc29474_0.s -o test.o
*** Deleting temp files:
Deleting: /tmp/ghc29474_0/ghc29474_0.s
*** Deleting temp dirs:
Deleting: /tmp/ghc29474_0
ghc: could not execute: /usr/bin/gcc

Otherwise gcc not mentioned, no error mentioned.

Dusan


On 02/08/2011 01:04 PM, Christian Maeder wrote:

Does adding -v reveal when /usr/bin/gcc is used?

ghc -v -O2 --make test.hs -o test

C.

Am 08.02.2011 11:39, schrieb Dušan Kolář:

Hello all,

I'm trying to build platform on Linux 2.6.32.22 #1 SMP Tue Sep 21
09:44:04 CEST 2010 x86_64 x86_64 x86_64 GNU/Linux. I've downloaded
binary of ghc6.12.3 for the purpose, but ghc doesn't work. ghci does
work, gcc does work, but for ghc I get:

ghc -O2 --make test.hs -o test
[1 of 1] Compiling Main ( test.hs, test.o )
ghc: could not execute: /usr/bin/gcc

Even if I can easily compile gcc testc.c -o testc and run testc.

Could anyone point me to a solution? Helps found by google pointed me to
try use option -pgmc gcc, which doesn't work. All other threads with
similar issue stayed unresoleved. :-(

Thanks

 Dusan


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


[Haskell-cafe] Is EclipseFP alive?

2010-11-27 Thread Dušan Kolář

Hello,

  I tried to install EclipseFP using instructions on 
http://eclipsefp.sourceforge.net/, nevertheless, without any success - 
after downloading scion I cannot build it


 cabal install
Resolving dependencies...
cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however
Cabal-1.8.0.6 was excluded because scion-0.1.0.6 requires Cabal ==1.6.*

Running Setup.hs through runhaskell seems not to work as well:
 runhaskell Setup.hs configure
Configuring scion-0.1.0.6...
Setup.hs: At least the following dependencies are missing:
AttoJson =0.5.2,
binary ==0.5.*,
derive -any,
ghc-paths ==0.1.*,
ghc-syb -any,
ghc-syb-utils -any,
hslogger ==1.0.*,
list-tries -any,
multiset =0.1  0.3,
uniplate -any

Even if, for instance:
 cabal info binary
* binary   (library)
Synopsis:  Binary serialisation for Haskell values using lazy
   ByteStrings
Latest version available: 0.5.0.2
Latest version installed: 0.5.0.2

Is there any chance to make it install or should I give up?

Dusan

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


[Haskell-cafe] Class instances on class constraints

2010-07-28 Thread Dušan Kolář

 Hello all,

  For school purposes, I would like to define something like this:

module SetOverList(
 SetFromList
   , SetOL(..)
   ) where


type SetFromList a = [a]


addEq :: Eq a = a - SetFromList a - SetFromList a
addEq v [] = [v]
addEq v l@(x:xs) = if x==v then l else x : addEq v xs

addOrd :: Ord a = a - SetFromList a - SetFromList a
addOrd v [] = [v]
addOrd v l@(x:xs) =
  case compare x v of
GT - v : l
EQ - l
LT - x : addOrd v xs


class SetOL a where
  addElem :: a - SetFromList a - SetFromList a


instance (Eq a) = SetOL a where
  addElem = addEq


instance (Ord a) = SetOL a where
  addElem = addOrd


which does not work, of course (Flexible or Undecidable instances won't 
help). The aim is to have addElem function that works differently 
according to situation whether a type, which is base of the list/set, is 
a member of class Eq or Ord. Could you point me or hint me how to get as 
close as possible to the required solution? Maybe I'm not able to see an 
obvious way...


Thanks,

Dušan


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


Re: [Haskell-cafe] Class instances on class constraints

2010-07-28 Thread Dušan Kolář

 Yes! Thanks.

Dušan

On 07/28/2010 01:03 PM, Felipe Lessa wrote:

2010/7/28 Dušan Kolářko...@fit.vutbr.cz:

which does not work, of course (Flexible or Undecidable instances won't
help). The aim is to have addElem function that works differently according
to situation whether a type, which is base of the list/set, is a member of
class Eq or Ord. Could you point me or hint me how to get as close as
possible to the required solution? Maybe I'm not able to see an obvious
way...

Use the good'ol trick:

newtype ByEq a = ByEq {unByEq :: a}
newtype ByOrd a = ByOrd {unByOrd :: a}

instance (Eq a) =  SetOL (ByEq a) where
   addElem = addEq . unByEq

instance (Ord a) =  SetOL (ByOrd a) where
   addElem = addOrd . unByOrd

Cheers,


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


[Haskell-cafe] Installing wx via cabal

2010-02-21 Thread Dušan Kolář

Dear all,

  Running cabal install --global wx stops very soon with the following 
error.


Building wxcore-0.12.1.2...
[ 1 of 22] Compiling Graphics.UI.WXCore.WxcObject ( 
src/haskell/Graphics/UI/WXCore/WxcObject.hs, 
dist/build/Graphics/UI/WXCore/WxcObject.o )
[ 2 of 22] Compiling Graphics.UI.WXCore.WxcDefs ( 
src/haskell/Graphics/UI/WXCore/WxcDefs.hs, 
dist/build/Graphics/UI/WXCore/WxcDefs.o )
[ 3 of 22] Compiling Graphics.UI.WXCore.WxcClassTypes ( 
src/haskell/Graphics/UI/WXCore/WxcClassTypes.hs, 
dist/build/Graphics/UI/WXCore/WxcClassTypes.o )
[ 4 of 22] Compiling Graphics.UI.WXCore.WxcTypes ( 
src/haskell/Graphics/UI/WXCore/WxcTypes.hs, 
dist/build/Graphics/UI/WXCore/WxcTypes.o )
[ 5 of 22] Compiling Graphics.UI.WXCore.WxcClassesAL ( 
src/haskell/Graphics/UI/WXCore/WxcClassesAL.hs, 
dist/build/Graphics/UI/WXCore/WxcClassesAL.o )

ghc: out of memory (requested 1048576 bytes)
cabal: Error: some packages failed to install:

It seems quite strange as the machine seems to have 16GB RAM and a free 
swap, can I somehow put options or so? I have ghc 10.4. installed.


Thanks

  Dusan

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


[Haskell-cafe] OT: Literature on translation of lambda calculus to combinators

2010-01-28 Thread Dušan Kolář

Dear cafe,

  Could anyone provide a link to some paper/book (electronic version of 
both preferred, even if not free) that describes an algorithm of 
translation of untyped lambda calculus expression to a set of 
combinators? Preferably SKI or BCKW. I'm either feeding google with 
wrong question or there is no link available now...


  Thanks,

Dušan

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


[Haskell-cafe] Naive booleans and numbers - type-checking fails

2010-01-24 Thread Dušan Kolář

Dear cafe,

  I'm trying to prepare a naive definition of booleans, numbers and 
some helper functions such a way, so that definition in lambda-calculus 
can be used in a straightforward way in Haskell. I was caught in trouble 
quite soon during change of lambda-expressions to Haskell - defining 
prefn as a helper for prev. When using Haskell-ish if-then-else then 
there is no problem (the code commented out), while using defined 
if-then-else (mif), the type-checking fails, but just for this case! 
Other simple tests are OK for the mif. Do I need some extra option for 
type-checker, or is it a principal failure (infinite type is reported) - 
I'm running ghci 6.10.4.


 mtrue  x y = x
 mfalse x y = y

 m0 f n = n
 m1 f n = f n
 m2 f n = f (f n)

 msucc x g m = x g (g m)
 iszero m = m (\_ - mfalse) mtrue

 mif c t f = c t f
 mpair f s = \e - e f s
 mfst p = p mtrue
 msnd p = p mfalse

 -- mprefn f p = if mex True False then mth else mel
 mprefn f p = mif mex mth mel
   where
 mex = mfst p
 mth = mpair mfalse (msnd p)
 mel = mpair mfalse (f (msnd p))


Please, change of definitions is not a solution, I'm trying to follow 
available resources, so using something else is not an option. :-(


Thanks for any help

  Dusan

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


Re: [Haskell-cafe] Error during hlint install ?

2009-08-29 Thread Dušan Kolář

Yes, it works fine, now.

Thank you!

Dušan

Neil Mitchell wrote:

Hi Dusan,

  

 Am I doing something wrong if I get the following error during cabal
installation of hlint? Is there any way how to solve it?



The problem is that version 1.15 of hscolour released recently is
incompatible with 1.13 which HLint was being tested against.

I've now switched over to hscolour 1.15 and released HLint 1.6.6,
which does work with hscolour 1.15. This should solve your problem.

I didn't spot this email as I've been busy recently and have not had a
chance to read through haskell-cafe, but I did get your personal email
(but replied to everyone so that everyone can see the solution). In
general when emailing about my packages it's usually best to email
haskell-cafe and CC me.

Thanks for reporting the issue, and do let me know if the new version
still doesn't work. To upgrade you should be able to do:

cabal update  cabal install hlint

Thanks

Neil
  


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


[Haskell-cafe] OT: Is conference dead?

2009-05-12 Thread Dušan Kolář

Hello all,

 I'm sorry for the OT post, is the conference dead? I've got no mail 
since yeasterday afternoon. And that is quite unusual.


 Best regards,

   Dusan

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


Re: [Haskell-cafe] Threading and Mullticore Computation

2009-03-03 Thread Dušan Kolář

Hello,

 IMO, the conclusion about instant cache misses due to several threads 
sharing memory and/or performing large memory consumption is very highly 
probable, especially on Intel CPUs with shared L2 cache.


 I have several examples, where threading means significant time 
consumption increase (new time = number of threads * old time). My 
personal conclusion - use linear recursive functions only (so that they 
could be optimized), Int instead of Integer, if possible, no data 
structure traversal (unless such a structure is very small, L2 caches 
are several MBs only). Such a way cache misses are minimized for 
both/all threads. Moreover, OS needs some time instantly (= cache 
refill/misses), thus, I've devoted one core for OS, others for 
computation (quad core), which brings certain improvement and more 
accurate measurements.


 Regards

   Dusan

Bulat Ziganshin wrote:

Hello Andrew,

Tuesday, March 3, 2009, 9:21:42 PM, you wrote:

  

I just tried it with GHC 6.10.1. Two capabilities is still slower. (See
attachments. Compiled with -O2 -threaded.)



i don't think so:

  Total time4.88s  (  5.14s elapsed)

  Total time7.08s  (  4.69s elapsed)

so with 1 thread wall clock time is 5 seconds, with 2 thread wall time
is 4.7 seconds

cpu time spent increased with 2 threads - this indicates that you
either use hyperthreaded/SMT-capable cpu or speed is limited by memory
access operations

so, my conclusion - this benchmark limited by memory latencies so it
cannot be efficiently multithreaded


  


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


Re: [Haskell-cafe] Memoization local to a function

2009-02-26 Thread Dušan Kolář
Thanks for all the hints and code provided, nevertheless, it implied 
another questions:


1) Am I right that MemoCombinators can be hardly ever used with hugs? If 
not, which guidelines to be used for installation...
2) Is there any paper/tutorial/wiki that describes, which local 
definitions/expressions are discarded/not shared after/to the next 
computation, that means separated closure is built for them?


Dusan

Henning Thielemann wrote:


On Wed, 25 Feb 2009, Luke Palmer wrote:

On Wed, Feb 25, 2009 at 10:38 AM, Dusan Kolar ko...@fit.vutbr.cz 
wrote:
   I have a function a computation of which is quite expensive, 
it is recursively
  dependent on itself with respect to some other function values 
- we can roughly
  model its behaviour with fib function (returns n-th number of 
Fibonacci's
  sequence). Unfortunately, it is not fib, it is far more 
complicated.
  Nevertheless, for demonstration of my question/problem I will 
use fib, it's quite

  good.


I suggest using data-memocombinators for this rather than rolling 
your own.  It accomplishes
the same thing, but makes the choice of memo structure independent of 
the code that uses it

(and Memo.integral has asymptotically better performance than a list).


Nice to know that there is a package for this purpose. See also
  http://haskell.org/haskellwiki/Memoization


--

 Dusan Kolartel: +420 54 114 1238
 UIFS FIT VUT Brno  fax: +420 54 114 1270
 Bozetechova 2   e-mail: ko...@fit.vutbr.cz
 Brno 612 66
 Czech Republic

--

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


[Haskell-cafe] ByteString.pack behavior

2008-05-18 Thread Dušan Kolář

Hello all,

 Maybe there is something obvious I can't see, but I have this behavior 
for 6.8.2 ghci:


$ghci ttest1p.hs
GHCi, version 6.8.2: http://www.haskell.org/ghc/  :? for help
Loading package base ... linking ... done.
[1 of 1] Compiling Main ( ttest1p.hs, interpreted )
Ok, modules loaded: Main.
*Main encode' [1..100]
Loading package array-0.1.0.0 ... linking ... done.
Loading package bytestring-0.9.0.1 ... linking ... done.
[1,0,2,0,3,0,4,0,5,0,6,0,7,0,8,0,9,0,10,0,11,0,12,0,13,0,... // deleted
*Main B.pack [0..100]
\NUL\SOH\STX\ETX\EOT\ENQ\ACK\a\b\t\n\v\f\r\SO\SI\DLE\DC1\DC2\DC3\DC4\NAK\SYN\ETB\CAN\EM\SUB\ESC\FS\GS\RS\US 
!\#$%'()*+,-./0123456789:;=[EMAIL PROTECTED]

*Main B.pack $ encode' [1..100]
*** Exception: divide by zero

where ttest1p.hs:

import qualified Data.ByteString as B

encode' [] = []
encode' (x:xs) =
 if x==0 then 0:0:encode' xs
 else (x `mod` 256) : (x `div` 256) : encode' xs


What is the difference, except list length and value structure? Where is 
my error?


Thanks for any hint,

Dusan

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


[Haskell-cafe] User data type with operator contructors only

2006-09-05 Thread Dušan Kolář

Hello all,

 my question probably comes from not reading manual properly. But, why 
is it not possible to have something like:


infixr 5 :

data Stack a
 = a : (Stack a)
 | :||

And if yes, how can I do that? I know that lists are a hack in Haskell, 
but anyway. Having:


infixr 5 :

data Stack a
 = a : (Stack a)
 | Bottom

is not what I would like to have. :-(

Thanks for any reference to/or explanation,

 Dusan



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


Re: [Haskell-cafe] User data type with operator contructors only

2006-09-05 Thread Dušan Kolář

Donald Bruce Stewart wrote:

kolar:
  

Hello all,

 my question probably comes from not reading manual properly. But, why 
is it not possible to have something like:


infixr 5 :

data Stack a
 = a : (Stack a)
 | :||

And if yes, how can I do that? I know that lists are a hack in Haskell, 



infixr 5 :

data Stack a = a : (Stack a) | (:||)

test = 7 : 8 : 2 : (:||)

Not ideal, though, I suppose.

-- Don
  
Hmm, I see, ghci works, but hugs not. That was my problem. Sorry for 
asking. I've thought this would work in both. :-(


Dusan


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


[Haskell-cafe] OT - lamba calculus definition - alpha reduction

2006-05-29 Thread Dušan Kolář

Hello all,

 I'm asking in place of several my colleagues and myself of course. The 
question is almost off topic. It is from lambda calculus definition, in 
particular, definition of alpha reduction (and others as well).


Alpha reduction definition: a lambda expression (\v.e) can be 
transformed (reduced) to (\v'.e[v'/v]) if the substitution e[v'/v] is valid.


Beta reduction definition: a lambda expression (e1 e2) can be reduced to 
the expression e[e2/v] if e1 is of the form (\v.e) and if the 
substitution e[e2/v] is valid.


Eta reduction definition: a lambda expression e can be reduced to a 
lambda expression (\v.e v) if v is not free in e.



OK. If we have these two expressions:
 1) (\x.x b x)
 2) (\x.x c x)

The question is, are they equal? (They are not identical, of course.)
For answer no, there is a strong argument - there is no reduction 
sequence that can make these identical.

On the other hand, their meaning expresses the same operation.

Well, what is the answer? I will be lucky with any link to WWW resource 
or your opinion. Nevertheless, the more formal and precise your answer 
will be the more I will be lucky. ;-)


Thx and regards

 Dusan

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


Re: [Haskell-cafe] OT - lamba calculus definition - alpha reduction

2006-05-29 Thread Dušan Kolář





 I'm asking in place of several my colleagues and myself of course. 
The question is almost off topic. It is from lambda calculus 
definition, in particular, definition of alpha reduction (and others 
as well).


Alpha reduction definition: a lambda expression (\v.e) can be 
transformed (reduced) to (\v'.e[v'/v]) if the substitution e[v'/v] is 
valid.


Beta reduction definition: a lambda expression (e1 e2) can be reduced 
to the expression e[e2/v] if e1 is of the form (\v.e) and if the 
substitution e[e2/v] is valid.


Eta reduction definition: a lambda expression e can be reduced to a 
lambda expression (\v.e v) if v is not free in e.



OK. If we have these two expressions:
 1) (\x.x b x)
 2) (\x.x c x)

The question is, are they equal? (They are not identical, of course.)
For answer no, there is a strong argument - there is no reduction 
sequence that can make these identical.

On the other hand, their meaning expresses the same operation.

Well, what is the answer? I will be lucky with any link to WWW 
resource or your opinion. Nevertheless, the more formal and precise 
your answer will be the more I will be lucky. ;-)


If b and c are free, then no, they can't be considered equal, and i 
don't see how you can find a common meaning in this case either.

Those two are equivalent: (\b.\x.x b x) = (\c.\x.x c x).


Yes, those of yours are equal of no doubt.
Those of mine are not, that's even my opinion, on the other hand, I was 
not precise enough in my explanation. Those of mine have the same 
behavior unless you mean something else by variables b and c. Otherwise 
the behavior is the same, isn't it? If the behavior is the same, they 
can be interchanged and, thus, they are equal...


OK, I agree this may be a more philosophical question. ;-)

Thanks,

 Dusan

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