[Haskell-cafe] Threadscope 0.2.2 goes in segmentation fault on Mac Os X 10.8.3

2013-03-30 Thread Alfredo Di Napoli
Hi Cafè,

I've tried installing threadscope, but when I run it from console with
threadscope I get a laconic segmentation fault.
Some info to help the debugging:

* Installed gtk via brew
* gtk-demo runs correctly
* I'm using Mac Os X 10.8.3
* Running gtk and threadscope through a virtual environment (provided by
hsenv)
* Using XQuartz 2.7.4

I know it's a bit difficult to debug this way, I can try debugging with gdb
if it can help.

Cheers,

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


Re: [Haskell-cafe] Threadscope 0.2.2 goes in segmentation fault on Mac Os X 10.8.3

2013-03-30 Thread John Wiegley
 Alfredo Di Napoli alfredo.dinap...@gmail.com writes:

 I know it's a bit difficult to debug this way, I can try debugging with gdb
 if it can help.

Yes, can you show us a backtrace from gdb, and also look in your CrashReports
log folder to see if it gives a bit more information on the state of the
process at the time it died?

Thanks,
-- 
John Wiegley
FP Complete Haskell tools, training and consulting
http://fpcomplete.com   johnw on #haskell/irc.freenode.net

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


[Haskell-cafe] Optimizing Fold Expressions

2013-03-30 Thread J. J. W.
Dear all,

I was wondering whether it was possible to write fold expressions more
elegantly. Suppose I have the following
datastructure:

data Expr = Add Expr Expr
  | Sub Expr Expr
  | Mul Expr Expr
  | Eq  Expr Expr
  | B Bool
  | I Int
  deriving Show

type ExprAlgebra r = (r - r - r, -- Add
  r - r - r, -- Sub
  r - r - r, -- Mul
  r - r - r, -- Eq
  Bool   - r, -- Bool
  Int - r -- Int
  )

foldAlgebra :: ExprAlgebra r - Expr - r
foldAlgebra alg@(a, b, c ,d, e, f) (Add x y) = a (foldAlgebra alg x)
(foldAlgebra alg y)
foldAlgebra alg@(a, b, c ,d, e, f) (Sub x y) = b (foldAlgebra alg x)
(foldAlgebra alg y)
foldAlgebra alg@(a, b, c ,d, e, f) (Mul x y) = c (foldAlgebra alg x)
(foldAlgebra alg y)
foldAlgebra alg@(a, b, c ,d, e, f) (Eq  x y) = d (foldAlgebra alg x)
(foldAlgebra alg y)
foldAlgebra alg@(a, b, c ,d, e, f) (B b')= e b'
foldAlgebra alg@(a, b, c ,d, e, f) (I i) = f i

If I am correct, this works, however if we for example would like to
replace all Int's by booleans (note: this is to illustrate my problem):

replaceIntByBool = foldAlgebra (Add, Sub, Mul, Eq, B, \x - if x == 0 then
B False else B True)

As you can see, a lot of useless identity code. Can I somehow optimize
this? Can someone give me some pointers how I can write this more clearly
(or with less code?) So I constantly don't have to write Add, Sub, Mul, for
those things that I just want an identity function?

Thanks in advance!

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


Re: [Haskell-cafe] [ANN] hoodle-0.2

2013-03-30 Thread Anton Kholomiov
Things I have to install on Ubuntu to get it going: librsvg2-dev (for
svgcairo), libpoppler-glib-dev (for poppler), libgd2-xpm-dev (for gd).



2013/3/30 Ian-Woo Kim ianwoo...@gmail.com

 Hi, all,

 Pen note-taking program hoodle, which is being developed entirely in
 haskell, is updated to version 0.2.
 The previous version was 0.1.1.
 About what is hoodle, please refer to http://ianwookim.org/hoodle

 The changes in this version are
 - hoodle data format updated. now hoodle document has a unique id.
 - linking between documents implemented
 - vertical space inserting tool implemented
 - a widget introduced for panning and zooming
 - drag and drop linking implemented
 - drag and drop image embedding implemented
 - poppler pdf support is mandatory
 - pdf can be embedded in a file
 - toolbox ui reflects current hoodle state more correctly
 - slimmer select box design
 - several rendering glitches fixed

 Note that poppler is mandatory for hoodle (in the previous versions,
 poppler support was optional). One needs to install poppler-glib before
 installing hoodle.
 After gtk2hs and poppler installed, installing hoodle should be simply

  cabal install hoodle

 As for the detail information about wacom tablet support, please read
 installation page on the webpage.

 If you were using the previous versions of hoodle, you will find this
 version gives you much smoother experience and many interesting
 improvements. (especially adding vertical space tool and pan-zoom widget )

 Enjoy~

 best,
 Ian-Woo Kim


 ___
 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] [ANN] hoodle-0.2

2013-03-30 Thread Ian-Woo Kim
Oh. Thanks for the report.
I forgot to mention librsvg and gd2 dependence. They are mandatory for svg,
jpeg, png processing in hoodle.
I will make a note on that on the hoodle web page.

Thanks!

IW


On Sat, Mar 30, 2013 at 2:57 PM, Anton Kholomiov
anton.kholom...@gmail.comwrote:

 Things I have to install on Ubuntu to get it going: librsvg2-dev (for
 svgcairo), libpoppler-glib-dev (for poppler), libgd2-xpm-dev (for gd).



 2013/3/30 Ian-Woo Kim ianwoo...@gmail.com

 Hi, all,

 Pen note-taking program hoodle, which is being developed entirely in
 haskell, is updated to version 0.2.
 The previous version was 0.1.1.
 About what is hoodle, please refer to http://ianwookim.org/hoodle

 The changes in this version are
 - hoodle data format updated. now hoodle document has a unique id.
 - linking between documents implemented
 - vertical space inserting tool implemented
 - a widget introduced for panning and zooming
 - drag and drop linking implemented
 - drag and drop image embedding implemented
 - poppler pdf support is mandatory
 - pdf can be embedded in a file
 - toolbox ui reflects current hoodle state more correctly
 - slimmer select box design
 - several rendering glitches fixed

 Note that poppler is mandatory for hoodle (in the previous versions,
 poppler support was optional). One needs to install poppler-glib before
 installing hoodle.
 After gtk2hs and poppler installed, installing hoodle should be simply

  cabal install hoodle

 As for the detail information about wacom tablet support, please read
 installation page on the webpage.

 If you were using the previous versions of hoodle, you will find this
 version gives you much smoother experience and many interesting
 improvements. (especially adding vertical space tool and pan-zoom widget )

 Enjoy~

 best,
 Ian-Woo Kim


 ___
 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] Optimizing Fold Expressions

2013-03-30 Thread Roman Cheplyaka
The solution to this problem is called scrap your boilerplate.
There are a few libraries that implement it, in different variations.

Let me show you how to do it using my library, 'traverse-with-class'.
You'll need install it and the 'tagged' package to run this example.

  {-# LANGUAGE TemplateHaskell, ImplicitParams, OverlappingInstances,
  MultiParamTypeClasses, ConstraintKinds, UndecidableInstances #-}

  import Data.Generics.Traversable
  import Data.Generics.Traversable.TH
  import Data.Proxy

  data Expr = Add Expr Expr
| Sub Expr Expr
| Mul Expr Expr
| Eq  Expr Expr
| B Bool
| I Int
deriving Show

  -- derive a GTraversable instance for our type
  deriveGTraversable ''Expr

  -- class to perform our operation
  class IntToBool a where
intToBool :: a - a

  -- case for expressions: no recursion, we care only about the one level.
  -- The everywhere function will do recursion for us.
  instance IntToBool Expr where
intToBool (I x) = B $ if x == 0 then False else True
intToBool e = e -- default case for non-I constructors

  -- default case for non-expression types (such as Int): do nothing
  instance IntToBool a where
intToBool = id

  -- the final implementation
  replaceIntByBool :: Expr - Expr
  replaceIntByBool =
let ?c = Proxy :: Proxy IntToBool in
everywhere intToBool

Roman

* J. J. W. bsc.j@gmail.com [2013-03-30 19:45:35+0100]
 Dear all,
 
 I was wondering whether it was possible to write fold expressions more
 elegantly. Suppose I have the following
 datastructure:
 
 data Expr = Add Expr Expr
   | Sub Expr Expr
   | Mul Expr Expr
   | Eq  Expr Expr
   | B Bool
   | I Int
   deriving Show
 
 type ExprAlgebra r = (r - r - r, -- Add
   r - r - r, -- Sub
   r - r - r, -- Mul
   r - r - r, -- Eq
   Bool   - r, -- Bool
   Int - r -- Int
   )
 
 foldAlgebra :: ExprAlgebra r - Expr - r
 foldAlgebra alg@(a, b, c ,d, e, f) (Add x y) = a (foldAlgebra alg x)
 (foldAlgebra alg y)
 foldAlgebra alg@(a, b, c ,d, e, f) (Sub x y) = b (foldAlgebra alg x)
 (foldAlgebra alg y)
 foldAlgebra alg@(a, b, c ,d, e, f) (Mul x y) = c (foldAlgebra alg x)
 (foldAlgebra alg y)
 foldAlgebra alg@(a, b, c ,d, e, f) (Eq  x y) = d (foldAlgebra alg x)
 (foldAlgebra alg y)
 foldAlgebra alg@(a, b, c ,d, e, f) (B b')= e b'
 foldAlgebra alg@(a, b, c ,d, e, f) (I i) = f i
 
 If I am correct, this works, however if we for example would like to
 replace all Int's by booleans (note: this is to illustrate my problem):
 
 replaceIntByBool = foldAlgebra (Add, Sub, Mul, Eq, B, \x - if x == 0 then
 B False else B True)
 
 As you can see, a lot of useless identity code. Can I somehow optimize
 this? Can someone give me some pointers how I can write this more clearly
 (or with less code?) So I constantly don't have to write Add, Sub, Mul, for
 those things that I just want an identity function?
 
 Thanks in advance!
 
 Jun Jie

 ___
 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] install cuda

2013-03-30 Thread Peter Caspers

Hi,

I am trying to install the cuda package on a Windows 7 enviroment. 
However I run into an error and can not figure out, what it is.


Can someone help ?

Thanks a lot
Peter

C:\Users\Peter\_dev\haskellcabal install cuda
Resolving dependencies...
[1 of 1] Compiling Main ( 
C:\Users\Peter\AppData\Local\Temp\cuda-0.5.0.1-11856\cuda-0.5.0.1\Setup.hs, 
C:\Users\Peter\AppData\Local\Temp\cuda-0.5.0.1

-11856\cuda-0.5.0.1\dist\setup\Main.o )
Linking 
C:\Users\Peter\AppData\Local\Temp\cuda-0.5.0.1-11856\cuda-0.5.0.1\dist\setup\setup.exe 
...

Configuring cuda-0.5.0.1...
cygwin warning:
  MS-DOS style path detected: 
C:\Users\Peter\AppData\Roaming\cabal/share/config.site
  Preferred POSIX equivalent is: 
/cygdrive/c/Users/Peter/AppData/Roaming/cabal/share/config.site
  CYGWIN environment variable option nodosfilewarning turns off this 
warning.

  Consult the user's guide for more details about POSIX paths:
http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
checking for gcc... C:\Program Files (x86)\Haskell 
Platform\2012.4.0.0\mingw\bin\gcc.exe

checking whether the C compiler works... no
configure: error: in 
`/cygdrive/c/Users/Peter/AppData/Local/Temp/cuda-0.5.0.1-11856/cuda-0.5.0.1':

configure: error: C compiler cannot create executables
See `config.log' for more details
cabal: Error: some packages failed to install:
cuda-0.5.0.1 failed during the configure step. The exception was:
ExitFailure 77

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


Re: [Haskell-cafe] Optimizing Fold Expressions

2013-03-30 Thread José Pedro Magalhães
Hi,

Actually, if you really want folds, you should use regular [1] instead.
Here's an example of
a generic fold using regular:

-- Datatype representing logical expressions
data Logic = Var String
   | Logic :-:  Logic  -- implication
   | Logic :-: Logic  -- equivalence
   | Logic ::  Logic  -- and (conjunction)
   | Logic :||:  Logic  -- or (disjunction)
   | Not Logic  -- not
   | T  -- true
   | F  -- false
   deriving Show

-- Instantiating Regular for Logic using TH
$(deriveAll ''Logic PFLogic)
type instance PF Logic = PFLogic

l1, l2, l3 :: Logic
l1 = Var p
l2 = Not l1
l3 = l1 :-: l2

-- Testing folding
ex7 :: Bool
ex7 = fold (alg (\_ - False)) l3 where
  alg env = (env  impl  (==)  ()  (||)  not  True  False)
  impl p q = not p || q



Cheers,
Pedro

[1] http://hackage.haskell.org/package/regular-0.3.4.2


On Sat, Mar 30, 2013 at 7:36 PM, Roman Cheplyaka r...@ro-che.info wrote:

 The solution to this problem is called scrap your boilerplate.
 There are a few libraries that implement it, in different variations.

 Let me show you how to do it using my library, 'traverse-with-class'.
 You'll need install it and the 'tagged' package to run this example.

   {-# LANGUAGE TemplateHaskell, ImplicitParams, OverlappingInstances,
   MultiParamTypeClasses, ConstraintKinds, UndecidableInstances #-}

   import Data.Generics.Traversable
   import Data.Generics.Traversable.TH
   import Data.Proxy

   data Expr = Add Expr Expr
 | Sub Expr Expr
 | Mul Expr Expr
 | Eq  Expr Expr
 | B Bool
 | I Int
 deriving Show

   -- derive a GTraversable instance for our type
   deriveGTraversable ''Expr

   -- class to perform our operation
   class IntToBool a where
 intToBool :: a - a

   -- case for expressions: no recursion, we care only about the one level.
   -- The everywhere function will do recursion for us.
   instance IntToBool Expr where
 intToBool (I x) = B $ if x == 0 then False else True
 intToBool e = e -- default case for non-I constructors

   -- default case for non-expression types (such as Int): do nothing
   instance IntToBool a where
 intToBool = id

   -- the final implementation
   replaceIntByBool :: Expr - Expr
   replaceIntByBool =
 let ?c = Proxy :: Proxy IntToBool in
 everywhere intToBool

 Roman

 * J. J. W. bsc.j@gmail.com [2013-03-30 19:45:35+0100]
  Dear all,
 
  I was wondering whether it was possible to write fold expressions more
  elegantly. Suppose I have the following
  datastructure:
 
  data Expr = Add Expr Expr
| Sub Expr Expr
| Mul Expr Expr
| Eq  Expr Expr
| B Bool
| I Int
deriving Show
 
  type ExprAlgebra r = (r - r - r, -- Add
r - r - r, -- Sub
r - r - r, -- Mul
r - r - r, -- Eq
Bool   - r, -- Bool
Int - r -- Int
)
 
  foldAlgebra :: ExprAlgebra r - Expr - r
  foldAlgebra alg@(a, b, c ,d, e, f) (Add x y) = a (foldAlgebra alg x)
  (foldAlgebra alg y)
  foldAlgebra alg@(a, b, c ,d, e, f) (Sub x y) = b (foldAlgebra alg x)
  (foldAlgebra alg y)
  foldAlgebra alg@(a, b, c ,d, e, f) (Mul x y) = c (foldAlgebra alg x)
  (foldAlgebra alg y)
  foldAlgebra alg@(a, b, c ,d, e, f) (Eq  x y) = d (foldAlgebra alg x)
  (foldAlgebra alg y)
  foldAlgebra alg@(a, b, c ,d, e, f) (B b')= e b'
  foldAlgebra alg@(a, b, c ,d, e, f) (I i) = f i
 
  If I am correct, this works, however if we for example would like to
  replace all Int's by booleans (note: this is to illustrate my problem):
 
  replaceIntByBool = foldAlgebra (Add, Sub, Mul, Eq, B, \x - if x == 0
 then
  B False else B True)
 
  As you can see, a lot of useless identity code. Can I somehow optimize
  this? Can someone give me some pointers how I can write this more clearly
  (or with less code?) So I constantly don't have to write Add, Sub, Mul,
 for
  those things that I just want an identity function?
 
  Thanks in advance!
 
  Jun Jie

  ___
  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] install cuda

2013-03-30 Thread Henk-Jan van Tuyl
On Sat, 30 Mar 2013 20:43:58 +0100, Peter Caspers pcaspers1...@gmail.com  
wrote:



Hi,

I am trying to install the cuda package on a Windows 7 enviroment.  
However I run into an error and can not figure out, what it is.

:
:

configure: error: C compiler cannot create executables
See `config.log' for more details

:

The message says it all:
  See `config.log' for more details
The config.log file is probably in the directory where cabal-install  
unpacks it (%appdata%\cabal\cuda-revision); you can also use the  
commands:

  cabal unpack cuda
  cd cuda
  cabal install
  notepad config.log

I just had the same error message for another package; from the config.log  
file it became clear, that the linker could not find the necessary  
library. Make sure, that the libraries and header files  can be found by  
the compiler and linker, by setting the proper environment variables, see  
[0]


Regards,
Henk-Jan van Tuyl


[0] http://www.haskell.org/haskellwiki/Windows#Tools_for_compilation


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
Haskell programming
--

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


Re: [Haskell-cafe] install cuda

2013-03-30 Thread Trevor L. McDonell
Hi,

CUDA package maintainer here. I don't have access to a Win7 box with compatible 
GPU, nor a lot of experience writing packages for windows. If you do get it 
working please send me a pull request on github. I'd be great to have this 
working for windows as well.

Cheers,
-Trevor


On 31/03/2013, at 10:56 AM, Henk-Jan van Tuyl hjgt...@chello.nl wrote:

 On Sat, 30 Mar 2013 20:43:58 +0100, Peter Caspers pcaspers1...@gmail.com 
 wrote:
 
 Hi,
 
 I am trying to install the cuda package on a Windows 7 enviroment. However I 
 run into an error and can not figure out, what it is.
 :
 :
 configure: error: C compiler cannot create executables
 See `config.log' for more details
 :
 
 The message says it all:
  See `config.log' for more details
 The config.log file is probably in the directory where cabal-install unpacks 
 it (%appdata%\cabal\cuda-revision); you can also use the commands:
  cabal unpack cuda
  cd cuda
  cabal install
  notepad config.log
 
 I just had the same error message for another package; from the config.log 
 file it became clear, that the linker could not find the necessary library. 
 Make sure, that the libraries and header files  can be found by the compiler 
 and linker, by setting the proper environment variables, see [0]
 
 Regards,
 Henk-Jan van Tuyl
 
 
 [0] http://www.haskell.org/haskellwiki/Windows#Tools_for_compilation
 
 
 -- 
 http://Van.Tuyl.eu/
 http://members.chello.nl/hjgtuyl/tourdemonad.html
 Haskell programming
 --
 
 ___
 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