Re: Glasgow-haskell-users Digest, Vol 212, Issue 5

2021-10-11 Thread Dominic Steinitz
Hi David

I am a long time user of ghc on OSX. I have seen that problem but never on 
native OSX only when using nix (and then I added it explicitly).

Two things spring to mind:
Add it explicitly on the compile command `-liconv`
Use nix and then you can control the build environment in a totally 
controllable and reproducible manner. This is actually easier than it sounds: 
`curl https://nixos.org/nix/install | sh` and `nix-env -I ghc`. If you get the 
same error with that then we can try adding `iconv` explicitly.
 Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.org
Twitter: @idontgetoutmuch

> 
> I have a conundrum on which advice would be appreciate. Does
> anyone know how to successfully install ghc on OSX
> I've tried various binary instalation routes:
> macports, brew, direct binary downloads from haskel.org
> All have the same result. when I try to compile a basic hello world program
> I get
> 
> Undefined symbols for architecture x86_64:
>  "_iconv", referenced from:
> 
> 
> I've triedgiong  through ghcup
> 
> 8.8.4
> 8.6.5.
> 8.10.2
> 8.10.7
> 9.0.1
> 
> all have the same problem.
> I'd be happy to build from source. Small problem: what Haskell compiler do
> I use?
> 
> Any advice on installs that works along with any changes to paths to avoid
> the iconv problems would be appreciated as currently my Haskell-related
> activities have come to a grinding halt. Switchig to a different OS would
> be nice but its not a
> feasible option a at present.Writing a compiler is starting to look
> attractive..
> 
> thanks
> David
> 
> -- 
> David Duke
> Emeritus Professor of Computer Science
> School of Computing University of Leeds UK
> E:duke.j.da...@gmail.com
> W:https://engineering.leeds.ac.uk/staff/334/Professor_David_Duke

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Re: accelerate-llvm problems

2017-02-22 Thread Dominic Steinitz
No go at the moment - I am using my tiny macbook on holiday which is on too old 
a version of Xcode. When I try to upgrade it tells me I am out of space. I 
think rather than fight I will wait until I get back to a machine with more 
resources.

> On 22 Feb 2017, at 07:02, Dominic Steinitz <domi...@steinitz.org> wrote:
> 
> Thanks - it seems I can only do this with home-brew for 3.9 - the flag is 
> ignored for 3.8 - I am building now and will report back.
> 
>> On 21 Feb 2017, at 15:44, Trevor McDonell <trevor.mcdon...@gmail.com 
>> <mailto:trevor.mcdon...@gmail.com>> wrote:
>> 
>> Hi Dominic,
>> 
>> You need to build/install LLVM with shared libraries.
>> 
>> Then, install llvm-general with -fshared-llvm (or, use my fork, which the 
>> stack.yaml files point to).
>> 
>> 
>> -Trev
>> 
>> P.S. On mobile, apologies for the terse reply.
>> On Wed, 22 Feb 2017 at 10:34 AM, Dominic Steinitz <idontgetoutm...@gmail.com 
>> <mailto:idontgetoutm...@gmail.com>> wrote:
>> I am trying to build accelerate-llvm but getting the ghc panics below. 
>> Here’s my config
>> 
>> > bash-3.2$ ghc-pkg list | grep llvm
>> > ghc-pkg list | grep llvm
>> > llvm-general-3.8.0.0
>> > llvm-general-pure-3.5.0.0
>> > llvm-general-pure-3.5.1.0
>> > llvm-general-pure-3.8.0.0
>> > bash-3.2$ ghc-pkg list | grep acc
>> > ghc-pkg list | grep acc
>> > accelerate-1.0.0.0
>> > bash-3.2$ ghc --version
>> > ghc --version
>> > The Glorious Glasgow Haskell Compilation System, version 7.10.2
>> 
>> If anyone has any ideas, I’d be very grateful.
>> 
>> > bash-3.2$ ~/Library/Haskell/bin/cabal build
>> > ~/Library/Haskell/bin/cabal build
>> > Building accelerate-llvm-1.0.0.0...
>> > Preprocessing library accelerate-llvm-1.0.0.0...
>> > ghc:
>> > lookupSymbol failed in relocateSection (RELOC_GOT)
>> > /usr/local/Cellar/llvm@3.8/3.8.1/lib/llvm-3.8/lib/libLLVMSupport.a: 
>> > unknown symbol `___dso_handle'
>> > [24 of 52] Compiling Data.Range.Range ( Data/Range/Range.hs, 
>> > dist/build/Data/Range/Range.o )
>> >
>> > :
>> > ghc: panic! (the 'impossible' happened)
>> >   (GHC version 7.10.2 for x86_64-apple-darwin):
>> >   Dynamic linker not initialised
>> >
>> > Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
>> > <http://www.haskell.org/ghc/reportabug>
>> >
>> > [31 of 52] Compiling Data.Array.Accelerate.LLVM.Util ( 
>> > Data/Array/Accelerate/LLVM/Util.hs, 
>> > dist/build/Data/Array/Accelerate/LLVM/Util.o )
>> >
>> > :
>> > ghc: unable to load package `llvm-general-3.8.0.0'
>> > [32 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Ptr ( 
>> > Data/Array/Accelerate/LLVM/CodeGen/Ptr.hs, 
>> > dist/build/Data/Array/Accelerate/LLVM/CodeGen/Ptr.o )
>> >
>> > :
>> > ghc: panic! (the 'impossible' happened)
>> >   (GHC version 7.10.2 for x86_64-apple-darwin):
>> >   Dynamic linker not initialised
>> >
>> > Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
>> > <http://www.haskell.org/ghc/reportabug>
>> >
>> > [33 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Monad[boot] ( 
>> > Data/Array/Accelerate/LLVM/CodeGen/Monad.hs-boot, 
>> > dist/build/Data/Array/Accelerate/LLVM/CodeGen/Monad.o-boot )
>> > [34 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.IR 
>> > <http://data.array.accelerate.llvm.codegen.ir/> ( 
>> > Data/Array/Accelerate/LLVM/CodeGen/IR.hs, 
>> > dist/build/Data/Array/Accelerate/LLVM/CodeGen/IR.o )
>> >
>> > :
>> > ghc: panic! (the 'impossible' happened)
>> >   (GHC version 7.10.2 for x86_64-apple-darwin):
>> >   Dynamic linker not initialised
>> >
>> > Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
>> > <http://www.haskell.org/ghc/reportabug>
>> >
>> > [44 of 52] Compiling Data.Array.Accelerate.LLVM.Execute.Environment ( 
>> > Data/Array/Accelerate/LLVM/Execute/Environment.hs, 
>> > dist/build/Data/Array/Accelerate/LLVM/Execute/Environment.o )
>> >
>> > :
>> > ghc: panic! (the 'impossible' happened)
>> >   (GHC version 7.10.2 for x86_64-apple-darwin):
>> >   Dynamic linker not initialised
>> >
>> > Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
>> > <http://www.haskell.org/ghc/reportabug>
>> 
> 

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Re: accelerate-llvm problems

2017-02-22 Thread Dominic Steinitz
Thanks - it seems I can only do this with home-brew for 3.9 - the flag is 
ignored for 3.8 - I am building now and will report back.

> On 21 Feb 2017, at 15:44, Trevor McDonell <trevor.mcdon...@gmail.com> wrote:
> 
> Hi Dominic,
> 
> You need to build/install LLVM with shared libraries.
> 
> Then, install llvm-general with -fshared-llvm (or, use my fork, which the 
> stack.yaml files point to).
> 
> 
> -Trev
> 
> P.S. On mobile, apologies for the terse reply.
> On Wed, 22 Feb 2017 at 10:34 AM, Dominic Steinitz <idontgetoutm...@gmail.com 
> <mailto:idontgetoutm...@gmail.com>> wrote:
> I am trying to build accelerate-llvm but getting the ghc panics below. Here’s 
> my config
> 
> > bash-3.2$ ghc-pkg list | grep llvm
> > ghc-pkg list | grep llvm
> > llvm-general-3.8.0.0
> > llvm-general-pure-3.5.0.0
> > llvm-general-pure-3.5.1.0
> > llvm-general-pure-3.8.0.0
> > bash-3.2$ ghc-pkg list | grep acc
> > ghc-pkg list | grep acc
> > accelerate-1.0.0.0
> > bash-3.2$ ghc --version
> > ghc --version
> > The Glorious Glasgow Haskell Compilation System, version 7.10.2
> 
> If anyone has any ideas, I’d be very grateful.
> 
> > bash-3.2$ ~/Library/Haskell/bin/cabal build
> > ~/Library/Haskell/bin/cabal build
> > Building accelerate-llvm-1.0.0.0...
> > Preprocessing library accelerate-llvm-1.0.0.0...
> > ghc:
> > lookupSymbol failed in relocateSection (RELOC_GOT)
> > /usr/local/Cellar/llvm@3.8/3.8.1/lib/llvm-3.8/lib/libLLVMSupport.a: unknown 
> > symbol `___dso_handle'
> > [24 of 52] Compiling Data.Range.Range ( Data/Range/Range.hs, 
> > dist/build/Data/Range/Range.o )
> >
> > :
> > ghc: panic! (the 'impossible' happened)
> >   (GHC version 7.10.2 for x86_64-apple-darwin):
> >   Dynamic linker not initialised
> >
> > Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
> > <http://www.haskell.org/ghc/reportabug>
> >
> > [31 of 52] Compiling Data.Array.Accelerate.LLVM.Util ( 
> > Data/Array/Accelerate/LLVM/Util.hs, 
> > dist/build/Data/Array/Accelerate/LLVM/Util.o )
> >
> > :
> > ghc: unable to load package `llvm-general-3.8.0.0'
> > [32 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Ptr ( 
> > Data/Array/Accelerate/LLVM/CodeGen/Ptr.hs, 
> > dist/build/Data/Array/Accelerate/LLVM/CodeGen/Ptr.o )
> >
> > :
> > ghc: panic! (the 'impossible' happened)
> >   (GHC version 7.10.2 for x86_64-apple-darwin):
> >   Dynamic linker not initialised
> >
> > Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
> > <http://www.haskell.org/ghc/reportabug>
> >
> > [33 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Monad[boot] ( 
> > Data/Array/Accelerate/LLVM/CodeGen/Monad.hs-boot, 
> > dist/build/Data/Array/Accelerate/LLVM/CodeGen/Monad.o-boot )
> > [34 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.IR 
> > <http://data.array.accelerate.llvm.codegen.ir/> ( 
> > Data/Array/Accelerate/LLVM/CodeGen/IR.hs, 
> > dist/build/Data/Array/Accelerate/LLVM/CodeGen/IR.o )
> >
> > :
> > ghc: panic! (the 'impossible' happened)
> >   (GHC version 7.10.2 for x86_64-apple-darwin):
> >   Dynamic linker not initialised
> >
> > Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
> > <http://www.haskell.org/ghc/reportabug>
> >
> > [44 of 52] Compiling Data.Array.Accelerate.LLVM.Execute.Environment ( 
> > Data/Array/Accelerate/LLVM/Execute/Environment.hs, 
> > dist/build/Data/Array/Accelerate/LLVM/Execute/Environment.o )
> >
> > :
> > ghc: panic! (the 'impossible' happened)
> >   (GHC version 7.10.2 for x86_64-apple-darwin):
> >   Dynamic linker not initialised
> >
> > Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
> > <http://www.haskell.org/ghc/reportabug>
> 

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


accelerate-llvm problems

2017-02-21 Thread Dominic Steinitz
I am trying to build accelerate-llvm but getting the ghc panics below. Here’s 
my config

> bash-3.2$ ghc-pkg list | grep llvm
> ghc-pkg list | grep llvm
>llvm-general-3.8.0.0
>llvm-general-pure-3.5.0.0
>llvm-general-pure-3.5.1.0
>llvm-general-pure-3.8.0.0
> bash-3.2$ ghc-pkg list | grep acc
> ghc-pkg list | grep acc
>accelerate-1.0.0.0
> bash-3.2$ ghc --version
> ghc --version
> The Glorious Glasgow Haskell Compilation System, version 7.10.2

If anyone has any ideas, I’d be very grateful.

> bash-3.2$ ~/Library/Haskell/bin/cabal build
> ~/Library/Haskell/bin/cabal build
> Building accelerate-llvm-1.0.0.0...
> Preprocessing library accelerate-llvm-1.0.0.0...
> ghc: 
> lookupSymbol failed in relocateSection (RELOC_GOT)
> /usr/local/Cellar/llvm@3.8/3.8.1/lib/llvm-3.8/lib/libLLVMSupport.a: unknown 
> symbol `___dso_handle'
> [24 of 52] Compiling Data.Range.Range ( Data/Range/Range.hs, 
> dist/build/Data/Range/Range.o )
> 
> :
>ghc: panic! (the 'impossible' happened)
>  (GHC version 7.10.2 for x86_64-apple-darwin):
>   Dynamic linker not initialised
> 
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
> 
> 
> [31 of 52] Compiling Data.Array.Accelerate.LLVM.Util ( 
> Data/Array/Accelerate/LLVM/Util.hs, 
> dist/build/Data/Array/Accelerate/LLVM/Util.o )
> 
> :
>ghc: unable to load package `llvm-general-3.8.0.0'
> [32 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Ptr ( 
> Data/Array/Accelerate/LLVM/CodeGen/Ptr.hs, 
> dist/build/Data/Array/Accelerate/LLVM/CodeGen/Ptr.o )
> 
> :
>ghc: panic! (the 'impossible' happened)
>  (GHC version 7.10.2 for x86_64-apple-darwin):
>   Dynamic linker not initialised
> 
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
> 
> 
> [33 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.Monad[boot] ( 
> Data/Array/Accelerate/LLVM/CodeGen/Monad.hs-boot, 
> dist/build/Data/Array/Accelerate/LLVM/CodeGen/Monad.o-boot )
> [34 of 52] Compiling Data.Array.Accelerate.LLVM.CodeGen.IR ( 
> Data/Array/Accelerate/LLVM/CodeGen/IR.hs, 
> dist/build/Data/Array/Accelerate/LLVM/CodeGen/IR.o )
> 
> :
>ghc: panic! (the 'impossible' happened)
>  (GHC version 7.10.2 for x86_64-apple-darwin):
>   Dynamic linker not initialised
> 
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
> 
> 
> [44 of 52] Compiling Data.Array.Accelerate.LLVM.Execute.Environment ( 
> Data/Array/Accelerate/LLVM/Execute/Environment.hs, 
> dist/build/Data/Array/Accelerate/LLVM/Execute/Environment.o )
> 
> :
>ghc: panic! (the 'impossible' happened)
>  (GHC version 7.10.2 for x86_64-apple-darwin):
>   Dynamic linker not initialised
> 
> Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug 
> ___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Floating Point Exceptions

2016-12-07 Thread Dominic Steinitz
Hello again,

I removed my dependency on hmatrix and enabled floating point exceptions via 
`feenableexcept` hoping to get a call stack showing me where the exception was 
being raised but alas all I get is

> *Main> main
> ghc: ghc-iserv terminated (-8)
> Leaving GHCi.


My googling didn’t turn up much but as far as I can tell ghc does *not* handle 
sigfpe (googling "haskell sigfpe” turns up blog posts on Haskell by someone 
called “sigfpe”). I think it would be jolly useful to be able to get stack 
traces of floating point exceptions. How much work would this be? I’d be happy 
to have a go at it if someone could provide help and guidance.

There seems to have been some discussion of it on the ghc-devs mailing list in 
September 
(https://mail.haskell.org/pipermail/ghc-devs/2016-September/date.html) but not 
much in the way of write up.

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Stack traces in ghci

2016-12-05 Thread Dominic Steinitz
PZZ_InternalziVectorizzed_constantAux_closure'
> ghc-iserv-prof: Could not on-demand load symbol 
> '_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziMatrix_Matrix_con_info'
> 
> ghc-iserv-prof: 
> lookupSymbol failed in relocateSection (relocate external)
> /Users/dom/Dropbox/Private/Stochastic/demo/.cabal-sandbox/lib/x86_64-osx-ghc-8.0.1/hmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ/libHShmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ_p.a:
>  unknown symbol 
> `_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziMatrix_Matrix_con_info'
> ghc-iserv-prof: Could not on-demand load symbol 
> '_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziElement_zgzl_info'
> 
> ghc-iserv-prof: 
> lookupSymbol failed in relocateSection (relocate external)
> /Users/dom/Dropbox/Private/Stochastic/demo/.cabal-sandbox/lib/x86_64-osx-ghc-8.0.1/hmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ/libHShmatrix-0.18.0.0-7aYEqJARQEvKYNyM4UGAPZ_p.a:
>  unknown symbol 
> `_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziElement_zgzl_info'
> ghc-iserv-prof: Could not on-demand load symbol 
> '_hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziUtil_zdfIndexableVectorDouble_closure'
> 
> 
> ByteCodeLink.lookupCE
> During interactive linking, GHCi couldn't find the following symbol:
>   
> hmatrixzm0zi18zi0zi0zm7aYEqJARQEvKYNyM4UGAPZZ_InternalziUtil_zdfIndexableVectorDouble_closure
> This may be due to you not asking GHCi to load extra object files,
> archives or DLLs needed by your current session.  Restart GHCi, specifying
> the missing library using the -L/path/to/object/dir and -lmissinglibname
> flags, or simply by naming the relevant files on the GHCi command line.
> Alternatively, this link failure might indicate a bug in GHCi.
> If you suspect the latter, please send a bug report to:
>   glasgow-haskell-b...@haskell.org



Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Re: GHC Performance / Replacement for R?

2016-08-31 Thread Dominic Steinitz

Hi Iavor,

Thank you very much for this. It's nice to know that we have the ability 
in Haskell to be as frugal (or profligate) with memory as R when working 
with data frames. I should say this number of fields is quite low in the 
data science world. Data sets with 500 columns are not uncommon and I 
did have one with 10,000 columns!


I know other folks have worked on producing something like data frames 
e.g. https://github.com/acowley/Frames and 
http://stla.github.io/stlapblog/posts/HaskellFrames.html for example but 
I wanted to remain in the world of relatively simple types and I haven't 
looked at its performance in terms of memory. On the plus side it did 
manage to read in the 10,000 column data set although ghc took about 5 
minutes to do the typechecking (I should say within ghci).


Just to mention that R is not the only language that has nice facilities 
for data exploration; python has a package called pandas: 
http://pandas.pydata.org.


I feel we still have a way to go to make Haskell provide as easy an 
environment for data exploration as R or Python but I shall continue on 
my crusade.


Many thanks once again, Dominic.


On 30/08/2016 22:05, Iavor Diatchki wrote:

Hello,

when you parse the CSV fully, you end up creating a lot of small 
bytestring objects, and each of these adds some overhead.   The 
vectors themselves add up some additional overhead.  All of this adds 
up when you have as many fields as you do.   An alternative would be 
to use a different representation for the data, which recomputes 
things when needed.   While this might be a bit slower in some cases, 
it could have significant saving in terms of memory use.   I wrote up 
a small example to illustrate what I have in mind, which should be 
attached to this e-mail.


Basically, instead of parsing the CSV file fully, I just indexed where 
the lines are (ref. the "rows" field of "CSV"). This allows me to 
access each row quickly, and the when I need to get a specific field, 
I simply parse the bytes of the row.
One could play all kinds of games like that, and I imagine R does 
something similar, although I have never looked at how it works.   To 
test the approach I generated ~200Mb of sample data (generator is also 
in the attached file), and I was able to filter it using ~240Mb, which 
is comparable to what you reported about R.  One could probably 
package all this up in library that supports "R like" operations.


These are the stats I get from -s:

   4,137,632,432 bytes allocated in the heap
 925,200 bytes copied during GC
 200,104,224 bytes maximum residency (2 sample(s))
   6,217,864 bytes maximum slop
 246 MB total memory in use (1 MB lost due to fragmentation)

 Tot time (elapsed)  Avg pause 
 Max pause
  Gen  0  7564 colls, 0 par0.024s   0.011s   0.s   
 0.0001s
  Gen  1 2 colls, 0 par0.000s   0.001s   0.0003s   
 0.0006s


  INITtime0.000s  (  0.000s elapsed)
  MUT time0.364s  (  0.451s elapsed)
  GC  time0.024s  (  0.011s elapsed)
  EXITtime0.000s  (  0.001s elapsed)
  Total   time0.388s  (  0.463s elapsed)

  %GC time   6.2%  (2.5% elapsed)

  Alloc rate11,367,122,065 bytes per MUT second

  Productivity  93.8% of total user, 78.6% of total elapsed

-Iavor




On Thu, Aug 25, 2016 at 3:31 AM, Simon Peyton Jones via 
Glasgow-haskell-users <glasgow-haskell-users@haskell.org 
<mailto:glasgow-haskell-users@haskell.org>> wrote:


Sounds bad.  But it'll need someone with bytestring expertise to
debug.  Maybe there's a GHC problem underlying; or maybe it's
shortcoming of bytestring.

Simon

|  -Original Message-
|  From: Glasgow-haskell-users [mailto:glasgow-haskell-users-
<mailto:glasgow-haskell-users->
| boun...@haskell.org <mailto:boun...@haskell.org>] On Behalf Of
Dominic Steinitz
|  Sent: 25 August 2016 10:11
|  To: GHC users <glasgow-haskell-users@haskell.org
<mailto:glasgow-haskell-users@haskell.org>>
|  Subject: GHC Performance / Replacement for R?
|
|  I am trying to use Haskell as a replacement for R but running
into two
|  problems which I describe below. Are there any plans to address the
|  performance issues I have encountered?
|
|   1. I seem to have to jump through a lot of hoops just to be
able to
|  select the data I am interested in.
|
|  {-# LANGUAGE ScopedTypeVariables #-}
|
|  {-# OPTIONS_GHC -Wall #-}
|
|  import Data.Csv hiding ( decodeByName )
|  import qualified Data.Vector as V
|
|  import Data.ByteString ( ByteString )
|  import qualified Data.ByteString.Char8 as B
|
|  import qualified Pipes.Prelude as P
|  import qualified Pipes.ByteString as Bytes import Pipes import
|  qualified Pipes.Csv as Csv import System.IO
|

GHC Performance / Replacement for R?

2016-08-25 Thread Dominic Steinitz
I am trying to use Haskell as a replacement for R but running into two
problems which I describe below. Are there any plans to address the
performance issues I have encountered?

 1. I seem to have to jump through a lot of hoops just to be able to
select the data I am interested in.

{-# LANGUAGE ScopedTypeVariables #-}

{-# OPTIONS_GHC -Wall #-}

import Data.Csv hiding ( decodeByName )
import qualified Data.Vector as V

import Data.ByteString ( ByteString )
import qualified Data.ByteString.Char8 as B

import qualified Pipes.Prelude as P
import qualified Pipes.ByteString as Bytes
import Pipes
import qualified Pipes.Csv as Csv
import System.IO

import qualified Control.Foldl as L

main :: IO ()
main = withFile "examples/787338586_T_ONTIME.csv" ReadMode $ \h -> do
  let csvs :: Producer (V.Vector ByteString) IO ()
  csvs = Csv.decode HasHeader (Bytes.fromHandle h) >-> P.concat
  uvectors :: Producer (V.Vector ByteString) IO ()
  uvectors = csvs  >-> P.map (V.foldr V.cons V.empty)
  vec_vec <- L.impurely P.foldM  L.vector uvectors
  print $ (vec_vec :: V.Vector (V.Vector ByteString)) V.! 17
  print $ V.length vec_vec
  let rockspring = V.filter (\x -> x V.! 8 == B.pack "RKS") vec_vec
  print $ V.length rockspring

Here's the equivalent R:

df <- read.csv("787338586_T_ONTIME.csv")
rockspring <- df[df$ORIGIN == "RKS",]

 2. Now I think I could improve the above to make an environment that
is more similar to the one my colleagues are used to in R but more
problematical is the memory usage.

 * 112.5M file
 * Just loading the source into ghci takes 142.7M
 * > foo <- readFile "examples/787338586_T_ONTIME.csv" > length foo
   takes me up to 4.75G. But we probably don't want to do this!
 * Let's try again.
 * > :set -XScopedTypeVariables
 * > h <- openFile "examples/787338586_T_ONTIME.csv" ReadMode
 * > let csvs :: Producer (V.Vector ByteString) IO () = Csv.decode HasHeader 
(Bytes.fromHandle h) >-> P.concat
 * > let uvectors :: Producer (V.Vector ByteString) IO () = csvs  >-> P.map 
(V.map id) >-> P.map (V.foldr V.cons V.empty)
 * > vec_vec :: V.Vector (V.Vector ByteString) <- L.impurely P.foldM  L.vector 
uvectors
 * Now I am up at 3.17G. In R I am under 221.3M.
 * > V.length rockspring takes a long time to return 155 and now I am
   at 3.5G!!! In R > rockspring <- df[df$ORIGIN == "RKS",] seems
   instantaneous and now uses only 379.5M.
 * > length(rockspring) 37 > length(df$ORIGIN) 471949 i.e. there are
   37 columns and 471,949 rows.

Running this as an executable gives

~/Dropbox/Private/labels $ ./examples/BugReport +RTS -s
["2014-01-01","EV","20366","N904EV","2512","10747","1074702","30747",
 "BRO","Brownsville, TX","Texas","11298","1129803","30194",
  "DFW","Dallas/Fort Worth, TX","Texas","0720","0718",
  "-2.00","8.00","0726","0837","7.00","0855","0844","-11.00","0.00",
  "","0.00","482.00","","","","","",""]
471949
155
  14,179,764,240 bytes allocated in the heap
   3,378,342,072 bytes copied during GC
 786,333,512 bytes maximum residency (13 sample(s))
  36,933,976 bytes maximum slop
1434 MB total memory in use (0 MB lost due to fragmentation)

 Tot time (elapsed)  Avg pause  Max pause
  Gen  0 26989 colls, 0 par1.423s   1.483s 0.0001s0.0039s
  Gen  113 colls, 0 par1.005s   1.499s 0.1153s0.6730s

  INITtime0.000s  (  0.003s elapsed)
  MUT time3.195s  (  3.193s elapsed)
  GC  time2.428s  (  2.982s elapsed)
  EXITtime0.016s  (  0.138s elapsed)
  Total   time5.642s  (  6.315s elapsed)

  %GC time  43.0%  (47.2% elapsed)

  Alloc rate4,437,740,019 bytes per MUT second

  Productivity  57.0% of total user, 50.9% of total elapsed

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Re: CMM-to-ASM: Register allocation wierdness

2016-06-16 Thread Dominic Steinitz
>  Hi, I am implementing unicode normalization in Haskell. I
> challenged myself to match the performance with the best C/C++
> implementation, the best being the ICU library. I am almost there,
> beating it in one of the benchmarks and within 30% for others. I am
> out of all application level tricks that I could think of and now
> need help from the compiler.

I can't answer your question but I am very happy that someone is
looking at performance issues.

I am sad that no-one has responded.

More generally, is there a story around what is happening to improve
performance?

Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


[Haskell] New Haddock

2016-06-06 Thread Dominic Steinitz
I couldn’t find an announcement of the new version of Haddock. You can now 
document your libraries even more beautifully. For
example,

> -- \[
> -- f(k;n,p) = \Pr(X = k) = \binom n k  p^k(1-p)^{n-k}
> -- \]

will render as

https://hackage.haskell.org/package/random-fu-0.2.7.0/docs/Data-Random-Distribution-Binomial.html#v:integralBinomialPDF
 
<https://hackage.haskell.org/package/random-fu-0.2.7.0/docs/Data-Random-Distribution-Binomial.html#v:integralBinomialPDF>

Also don’t forget you can put really nice diagrams in your documentation e.g. 
http://hackage.haskell.org/package/diagrams-contrib-1.3.0.7/docs/Diagrams-Example-Logo.html
 
<http://hackage.haskell.org/package/diagrams-contrib-1.3.0.7/docs/Diagrams-Example-Logo.html>
 and 
http://hackage.haskell.org/package/diagrams-contrib-1.3.0.7/docs/Diagrams-TwoD-Layout-Tree.html
 
<http://hackage.haskell.org/package/diagrams-contrib-1.3.0.7/docs/Diagrams-TwoD-Layout-Tree.html>.

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

___
Haskell mailing list
Haskell@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell


Re: [Haskell] Haskell Summer of Code

2016-03-01 Thread Dominic Steinitz
Sad news. I'd like to say a very big thank you to you and everyone else 
involved in organising our GSoC participation. I know it must have been a 
considerable amount of work. I for one really appreciate the efforts you have 
made on all our behalves.

On 01/03/2016 12:00, haskell-requ...@haskell.org wrote:
> I'm sorry to announce that this year haskell.org was not accepted for the
> 2016 Google Summer of Code.
> 
> 
Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

___
Haskell mailing list
Haskell@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell


Re: SIMD

2015-04-13 Thread Dominic Steinitz
Hi Geoff,

Thanks for the update. I found this 
https://ghc.haskell.org/trac/ghc/blog/weekly20141020

 Geoff Mainland stepped up and fixed Data Parallel Haskell to work with a new 
 version of vector and GHC. Austin had disabled DPH a few weeks prior due to 
 its difficulty to upgrade, and divergent source trees. With 7.10, GHC will 
 hopefully ship a more modern vector and dph to boot.

From what you say this has been superseded?

Also seems that this page  https://ghc.haskell.org/trac/ghc/wiki/SIMD 
https://ghc.haskell.org/trac/ghc/wiki/SIMD should be updated and if I knew 
what it should say I would volunteer to update it.

A bit of background on why I am asking these questions: I am working on a Monte 
Carlo simulation and performance is a key issue. We are using parallelisation 
to good effect (after some interesting issues with thread affinity 
https://ghc.haskell.org/trac/ghc/ticket/10229 
https://ghc.haskell.org/trac/ghc/ticket/10229) but I am trying to understand 
what other options might be available to speed things up.

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

 On 13 Apr 2015, at 13:37, Geoffrey Mainland mainl...@cs.drexel.edu wrote:
 
 SIMD support was merged to HEAD before the 7.8 release, so any version
 of GHC after 7.8 has SIMD support built-in.
 
 If you want a branch that compiles with DPH, I'm afraid you are out of
 luck. DPH no longer builds at all, and I believe Austin actually deleted
 the simd branch mentioned on the Wiki.
 
 Geoff
 
 On 04/13/2015 02:54 AM, Simon Peyton Jones wrote:
 
 Geoff Mainland is the originator of the SIMD instruction set work. 
 Let’s see what he says.
 
 
 
 Simon
 
 
 
 *From:*Glasgow-haskell-users
 [mailto:glasgow-haskell-users-boun...@haskell.org] *On Behalf Of
 *Dominic Steinitz
 *Sent:* 11 April 2015 17:45
 *To:* GHC users
 *Subject:* SIMD
 
 
 
 What’s the story with this? I tried to follow the instructions
 here: https://ghc.haskell.org/trac/ghc/wiki/SIMD but I get
 
 
 
~ $ git clone -b simd http://git.haskell.org/ghc.git
http://git.haskell.org/ghc.git http://git.haskell.org/ghc.git
 
Cloning into 'ghc'...
 
fatal: Remote branch simd not found in upstream origin
 
 
 
 Dominic Steinitz
 
 domi...@steinitz.org mailto:domi...@steinitz.org 
 mailto:domi...@steinitz.org mailto:domi...@steinitz.org
 
 http://idontgetoutmuch.wordpress.com http://idontgetoutmuch.wordpress.com/
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


SIMD

2015-04-11 Thread Dominic Steinitz
What’s the story with this? I tried to follow the instructions here: 
https://ghc.haskell.org/trac/ghc/wiki/SIMD 
https://ghc.haskell.org/trac/ghc/wiki/SIMD but I get

 ~ $ git clone -b simd http://git.haskell.org/ghc.git
 Cloning into 'ghc'...
 fatal: Remote branch simd not found in upstream origin


Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] Parallel Profiling

2015-04-02 Thread Dominic Steinitz
Hi Amos,

Thanks very much - I am taking a look.

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 30 Mar 2015, at 22:05, Amos Robinson amos.robin...@gmail.com wrote:

 Hi Dominic,
 
 A few years ago we wrote a program for analysing DPH runs, dph-event-seer. It 
 provides a few general analyses like percent of time with N threads running, 
 time between wake-ups etc. You might find it interesting, but I haven't 
 actually looked at ghc-events-analyse, so I don't know what it provides.
 
 I'm sorry, but to compile it without DPH you'd have to modify it to remove 
 DphOps*.
 
 https://github.com/ghc/packages-dph/blob/master/dph-event-seer/src/Main.hs
 
 Amos
 
 On Tue, 31 Mar 2015 at 04:38 Dominic Steinitz domi...@steinitz.org wrote:
 Does anyone know of any tools for analysing parallel program performance?
 
 I am trying to use threadscope but it keeps crashing with my 100M log file 
 and ghc-events-analyze is not going to help as I have many hundreds of 
 threads all carrying out the same computation. I think I’d like a library 
 that would allow me to construct my own analyses rather than display them via 
 GTK. There is ghc-events but that seems to be just for parsing the logs and I 
 couldn’t find anything that used it in the way I would like to (apart from 
 threadscope and ghc-events-analyze of course).
 
 Thanks
 
 Dominic Steinitz
 domi...@steinitz.org
 http://idontgetoutmuch.wordpress.com
 
 ___
 Haskell-Cafe mailing list
 haskell-c...@haskell.org
 http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Parallel Profiling

2015-03-30 Thread Dominic Steinitz
Does anyone know of any tools for analysing parallel program performance?

I am trying to use threadscope but it keeps crashing with my 100M log file and 
ghc-events-analyze is not going to help as I have many hundreds of threads all 
carrying out the same computation. I think I’d like a library that would allow 
me to construct my own analyses rather than display them via GTK. There is 
ghc-events but that seems to be just for parsing the logs and I couldn’t find 
anything that used it in the way I would like to (apart from threadscope and 
ghc-events-analyze of course).

Thanks

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://mail.haskell.org/cgi-bin/mailman/listinfo/glasgow-haskell-users


Equality Constraints (a ~ b)

2015-01-11 Thread Dominic Steinitz
Hi,

I am trying to find more background on these. They don’t exist in the Haskell 
2010 Language Report, they didn’t exist in ghc 6.8.2 but make an appearance in 
7.0.1. The documentation in the manual is rather sparse and doesn’t contain a 
reference: https://downloads.haskell.org/~ghc/latest/docs/users_guide.pdf 
section 7.11. Folk on #ghc referred me to 
http://research.microsoft.com/en-us/um/people/simonpj/papers/ext-f/. I can find 
papers that refer to ~ in F_C (aka FC?) but as far as I can tell not in the 
Haskell language itself.

Many thanks

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


RE: ANNOUNCE: GHC 7.10.1 Release Candidate 1

2014-12-29 Thread Dominic Steinitz
I counted about 10 people (including me) who appear to be actively keen on it 
on reddit: 
http://www.reddit.com/r/haskell/comments/2pnjdk/is_overloadedrecordfields_getting_it_into_7101/.
 I would guess there are others.

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 29 Dec 2014, at 12:00, glasgow-haskell-users-requ...@haskell.org wrote:

 
 Message: 3
 Date: Mon, 29 Dec 2014 10:29:23 +
 From: Simon Peyton Jones simo...@microsoft.com
 To: Kazu Yamamoto k...@iij.ad.jp, ghc-d...@haskell.org
   ghc-d...@haskell.org, glasgow-haskell-users@haskell.org
   glasgow-haskell-users@haskell.org
 Subject: RE: ANNOUNCE: GHC 7.10.1 Release Candidate 1
 Message-ID:
   
 618be556aadd624c9c918aa5d5911bef5628e...@db3prd3001mb020.064d.mgd.msft.net
   
 Content-Type: text/plain; charset=us-ascii
 
 | If I understand correctly, OverloadedRecordFields has not been merged
 | yet. Are there any chances to merge it into GHC 7.10.1?
 
 I'm afraid not.  The situation is that Adam has a fairly complete patch for 
 overloaded record fields, but neither he nor I are happy with it. It makes 
 some fairly complicated and pervasive changes, and feels like a sledgehammer 
 to crack a nut. We'd scheduled for Adam to spend a day at MSR for us to work 
 on it together, but Adam had to cancel.  We'll hopefully re-arrange.
 
 Meanwhile it'd be motivating to know who, if anyone, is actively keen on it.  
 Kazu is presumably one.  I expect there are others, but I couldn't list them.
 

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: CPP Help (was Re: Latest Template Haskell Breaks Package)

2014-12-24 Thread Dominic Steinitz
Thank you very much everyone. I now have a version of yarr which compiles under 
ghc 7.8.3. I have yet to do the conditional compilation hackery to support back 
versions but then I can make a release.

What a great community :-)

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com
___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


CPP Help (was Re: Latest Template Haskell Breaks Package)

2014-12-23 Thread Dominic Steinitz
Ok I have a cut down version of the problem and am cross posting to 
glasgow-haskell-users.

To restate the problem: this is from code that has not been changed for 2 
years. I get

 Examples.hs:42:42: Parse error in pattern: con
 Failed, modules loaded: none.

Any help would be very gratefully received.

 {-# LANGUAGE TypeFamilies, MultiParamTypeClasses, 
 FunctionalDependencies #-}
 {-# LANGUAGE FlexibleContexts #-}
 {-# LANGUAGE EmptyDataDecls #-}
 {-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
 {-# LANGUAGE UndecidableInstances, OverlappingInstances #-}
 {-# LANGUAGE GeneralizedNewtypeDeriving, StandaloneDeriving #-}
 {-# LANGUAGE RankNTypes, ScopedTypeVariables #-}
 {-# LANGUAGE MagicHash, BangPatterns, UnboxedTuples #-}
 {-# LANGUAGE TemplateHaskell, CPP #-}
 
 module Examples where
 
 import GHC.Prim
 import GHC.Exts
 import GHC.Types
 import GHC.Word
 import GHC.Int
 
 class Touchable a where
 touch :: a - IO ()
 
 instance Touchable Bool where
 touch b = IO (\s - case touch# b s of s' - (# s', () #))
 {-# INLINE touch #-}
 
 #define TOUCHABLE_INST(ty,con)  \
 instance Touchable ty where {   \
 touch (con x#) = IO (\s - case touch# x# s of s' - (# s', () #)); \
 {-# INLINE touch #-};   \
 }
 
 TOUCHABLE_INST(Int, I#)
 
 #define PRIM_COMP_INST(ty,con,le,ge) \
 instance PrimitiveOrd ty where { \
 minM' (con a#) (con b#) =\
 IO (\s -\
 let r# = if le a# b# then a# else b# \
 in case touch# r# s of s' - (# s', (con r#) #));\
 }
 
 PRIM_COMP_INST(Int, I#, (=#), (=#))

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 23 Dec 2014, at 15:06, Dominic Steinitz domi...@steinitz.org wrote:

 Hi Erik,
 
 Thank you very much. With that clue the compilation now doesn’t fail at that 
 particular point.
 
 The bad news is it now fails to compile this module
 
 https://hackage.haskell.org/package/yarr-1.3.2/docs/src/Data-Yarr-Utils-Primitive.html#clampM%27
 
 with a parse error(!). Not only do I not have much experience with TH but 
 this has now exposed my ignorance of CPP.
 
 Data/Yarr/Utils/Primitive.hs:119:126: Parse error in pattern: con
 
 If I comment out the last four lines
 
 PRIM_COMP_INST(Int, I#, (=#), (=#))
 PRIM_COMP_INST(Char, C#, leChar#, geChar#)
 PRIM_COMP_INST(Word, W#, leWord#, geWord#)
 PRIM_COMP_INST(Double, D#, (=##), (=##))
 PRIM_COMP_INST(Float, F#, leFloat#, geFloat#)
 
 then the module compiles but of course then the whole package does *not* 
 compile.
 
 Did something change in 7.8.3 with regard to CPP (this code has not been 
 modified for at least two years)?
 
 Thanks once again.
 
 Dominic Steinitz
 domi...@steinitz.org
 http://idontgetoutmuch.wordpress.com
 
 On 23 Dec 2014, at 13:42, Erik Hesselink hessel...@gmail.com wrote:
 
 Hi Dominic,
 
 It looks like just a representation change: a TySynEqn is a data type
 containing a [Type] and a Type, and those were the original two
 arguments. So it looks like with a little bit of CPP, you could
 support both versions. Something like
 
 #if MIN_VERSION_template_haskell(2,9,0)
 ...
 #else
 ...
 #endif
 
 In general, I think each major release of template haskell has quite
 some breaking changes, but I don't know of any place where they're
 enumerated. The GHC changelog only has a couple of high level bullet
 points.
 
 Regards,
 
 Erik
 
 On Tue, Dec 23, 2014 at 2:20 PM, Dominic Steinitz domi...@steinitz.org 
 wrote:
 I realise I should have sent this to the libraries list.
 
 Dominic Steinitz
 domi...@steinitz.org
 http://idontgetoutmuch.wordpress.com
 
 Begin forwarded message:
 
 From: Dominic Steinitz domi...@steinitz.org
 Subject: Latest Template Haskell Breaks Package
 Date: 23 December 2014 13:14:26 GMT
 To: Haskell-Cafe haskell-c...@haskell.org
 
 Hello Fellow Haskellers,
 
 I have become a maintainer for yarr
 (https://hackage.haskell.org/package/yarr). This no longer compiles with
 ghc-7.8.3 because it specifies base == 4.6. Relaxing this to base =4.6 
 4.8 tells me I need a newer version of Template Haskell
 
 rejecting: template-haskell-2.7.0.0, 2.6.0.0, 2.5.0.0, 2.4.0.1, 2.4.0.0,
 2.3.0.1, 2.3.0.0, 2.2.0.0 (conflict: yarr = template-haskell=2.8  2.9)
 
 
 If I now relax the constraint for Template Haskell I get a compiler error as
 there has been a breaking change from Template Haskell 2.9 to 2.10.
 
 Data/Yarr/Utils/FixedVector/VecTuple.hs:45:16:
   Couldn't match expected type ‘TypeQ - Q Dec’
   with actual type ‘Q Dec’
   The function ‘tySynInstD’ is applied to three arguments,
   but its type ‘Name - TySynEqnQ - DecQ’ has only two

Re: CPP Help (was Re: Latest Template Haskell Breaks Package)

2014-12-23 Thread Dominic Steinitz
How very clever of you and thank you very much. Changing ‘ to 1 does fix the 
problem.

I would have thought this would work

 cabal install --with-gcc=gcc-4.9

But sadly I still got the same error.

Do I need a special version of cpphs?

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 23 Dec 2014, at 15:58, Brandon Allbery allber...@gmail.com wrote:

 On Tue, Dec 23, 2014 at 10:46 AM, Dominic Steinitz domi...@steinitz.org 
 wrote:
 To restate the problem: this is from code that has not been changed for 2 
 years. I get
 
  Examples.hs:42:42: Parse error in pattern: con
  Failed, modules loaded: none.
 
 I think I see the problem. Are you by any chance on a machine which has clang 
 as its default C compiler (OS X, FreeBSD 9.3?/10.x/STABLE/CURRENT, possibly 
 others)? cpp will in that case malfunction because it won't substitute macro 
 parameters after the single quote:
 
  minM' (con a#) (con b#) =\
 
 -- 
 brandon s allbery kf8nh   sine nomine associates
 allber...@gmail.com  ballb...@sinenomine.net
 unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: CPP Help (was Re: Latest Template Haskell Breaks Package)

2014-12-23 Thread Dominic Steinitz
 $ cabal --version
 cabal-install version 1.19.1
 using version 1.19.1 of the Cabal library 

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 23 Dec 2014, at 15:54, Carter Schonwald carter.schonw...@gmail.com wrote:

 what version of cabal-install are you using?
 
 On Tue, Dec 23, 2014 at 10:46 AM, Dominic Steinitz domi...@steinitz.org 
 wrote:
 Ok I have a cut down version of the problem and am cross posting to 
 glasgow-haskell-users.
 
 To restate the problem: this is from code that has not been changed for 2 
 years. I get
 
  Examples.hs:42:42: Parse error in pattern: con
  Failed, modules loaded: none.
 
 Any help would be very gratefully received.
 
  {-# LANGUAGE TypeFamilies, MultiParamTypeClasses, 
  FunctionalDependencies #-}
  {-# LANGUAGE FlexibleContexts #-}
  {-# LANGUAGE EmptyDataDecls #-}
  {-# LANGUAGE FlexibleInstances, TypeSynonymInstances #-}
  {-# LANGUAGE UndecidableInstances, OverlappingInstances #-}
  {-# LANGUAGE GeneralizedNewtypeDeriving, StandaloneDeriving #-}
  {-# LANGUAGE RankNTypes, ScopedTypeVariables #-}
  {-# LANGUAGE MagicHash, BangPatterns, UnboxedTuples #-}
  {-# LANGUAGE TemplateHaskell, CPP #-}
 
  module Examples where
 
  import GHC.Prim
  import GHC.Exts
  import GHC.Types
  import GHC.Word
  import GHC.Int
 
  class Touchable a where
  touch :: a - IO ()
 
  instance Touchable Bool where
  touch b = IO (\s - case touch# b s of s' - (# s', () #))
  {-# INLINE touch #-}
 
  #define TOUCHABLE_INST(ty,con)  \
  instance Touchable ty where {   \
  touch (con x#) = IO (\s - case touch# x# s of s' - (# s', () #)); \
  {-# INLINE touch #-};   \
  }
 
  TOUCHABLE_INST(Int, I#)
 
  #define PRIM_COMP_INST(ty,con,le,ge) \
  instance PrimitiveOrd ty where { \
  minM' (con a#) (con b#) =\
  IO (\s -\
  let r# = if le a# b# then a# else b# \
  in case touch# r# s of s' - (# s', (con r#) #));\
  }
 
  PRIM_COMP_INST(Int, I#, (=#), (=#))
 
 Dominic Steinitz
 domi...@steinitz.org
 http://idontgetoutmuch.wordpress.com
 
 On 23 Dec 2014, at 15:06, Dominic Steinitz domi...@steinitz.org wrote:
 
  Hi Erik,
 
  Thank you very much. With that clue the compilation now doesn’t fail at 
  that particular point.
 
  The bad news is it now fails to compile this module
 
  https://hackage.haskell.org/package/yarr-1.3.2/docs/src/Data-Yarr-Utils-Primitive.html#clampM%27
 
  with a parse error(!). Not only do I not have much experience with TH but 
  this has now exposed my ignorance of CPP.
 
  Data/Yarr/Utils/Primitive.hs:119:126: Parse error in pattern: con
 
  If I comment out the last four lines
 
  PRIM_COMP_INST(Int, I#, (=#), (=#))
  PRIM_COMP_INST(Char, C#, leChar#, geChar#)
  PRIM_COMP_INST(Word, W#, leWord#, geWord#)
  PRIM_COMP_INST(Double, D#, (=##), (=##))
  PRIM_COMP_INST(Float, F#, leFloat#, geFloat#)
 
  then the module compiles but of course then the whole package does *not* 
  compile.
 
  Did something change in 7.8.3 with regard to CPP (this code has not been 
  modified for at least two years)?
 
  Thanks once again.
 
  Dominic Steinitz
  domi...@steinitz.org
  http://idontgetoutmuch.wordpress.com
 
  On 23 Dec 2014, at 13:42, Erik Hesselink hessel...@gmail.com wrote:
 
  Hi Dominic,
 
  It looks like just a representation change: a TySynEqn is a data type
  containing a [Type] and a Type, and those were the original two
  arguments. So it looks like with a little bit of CPP, you could
  support both versions. Something like
 
  #if MIN_VERSION_template_haskell(2,9,0)
  ...
  #else
  ...
  #endif
 
  In general, I think each major release of template haskell has quite
  some breaking changes, but I don't know of any place where they're
  enumerated. The GHC changelog only has a couple of high level bullet
  points.
 
  Regards,
 
  Erik
 
  On Tue, Dec 23, 2014 at 2:20 PM, Dominic Steinitz domi...@steinitz.org 
  wrote:
  I realise I should have sent this to the libraries list.
 
  Dominic Steinitz
  domi...@steinitz.org
  http://idontgetoutmuch.wordpress.com
 
  Begin forwarded message:
 
  From: Dominic Steinitz domi...@steinitz.org
  Subject: Latest Template Haskell Breaks Package
  Date: 23 December 2014 13:14:26 GMT
  To: Haskell-Cafe haskell-c...@haskell.org
 
  Hello Fellow Haskellers,
 
  I have become a maintainer for yarr
  (https://hackage.haskell.org/package/yarr). This no longer compiles with
  ghc-7.8.3 because it specifies base == 4.6. Relaxing this to base =4.6 
  4.8 tells me I need a newer version of Template Haskell
 
  rejecting: template-haskell-2.7.0.0, 2.6.0.0, 2.5.0.0, 2.4.0.1, 2.4.0.0

Re: [Haskell-cafe] llvm on macos

2013-08-20 Thread Dominic Steinitz
Dominic Steinitz dominic at steinitz.org writes:

Thanks for all the help everyone :-)


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


Re: [Haskell-cafe] llvm on macos

2013-08-11 Thread Dominic Steinitz
Thank you both.

I seem to be running LLVM 3.2 so I am a bit puzzled by the warning. Is it 
because I am running ghc 7.6.2?

 Dominics-MacBook-Pro:Laplace dom$ brew versions llvm
 3.2  git checkout 40e9b90 /usr/local/Library/Formula/llvm.rb
 3.1  git checkout 7d15192 /usr/local/Library/Formula/llvm.rb
 3.0  git checkout 8022bf4 /usr/local/Library/Formula/llvm.rb
 2.9  git checkout 471288b /usr/local/Library/Formula/llvm.rb
 2.8  git checkout 1fb85ef /usr/local/Library/Formula/llvm.rb
 2.7  git checkout d0efd9e /usr/local/Library/Formula/llvm.rb
 2.6  git checkout 6ae3b89 /usr/local/Library/Formula/llvm.rb
 Dominics-MacBook-Pro:Laplace dom$ llc --version
 LLVM (http://llvm.org/):
   LLVM version 3.2svn
   Optimized build with assertions.
   Built Dec 22 2012 (01:03:07).
   Default target: x86_64-apple-darwin12.3.0
   Host CPU: core-avx-i
 
   Registered Targets:
 x86- 32-bit X86: Pentium-Pro and above
 x86-64 - 64-bit X86: EM64T and AMD64
 Dominics-MacBook-Pro:Laplace dom$ opt --version
 LLVM (http://llvm.org/):
   LLVM version 3.2svn
   Optimized build with assertions.
   Built Dec 22 2012 (01:03:07).
   Default target: x86_64-apple-darwin12.3.0
   Host CPU: core-avx-i


 Dominics-MacBook-Pro:Laplace dom$ ghc --version
 The Glorious Glasgow Haskell Compilation System, version 7.6.2



Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 10 Aug 2013, at 18:41, Ozgur Akgun ozgurak...@gmail.com wrote:

 Hi.
 
 On 10 August 2013 18:20, Brandon Allbery allber...@gmail.com wrote:
 There may be some support for requesting specific versions from Homebrew.
 
 Try `brew versions llvm`. Then, you'll need to run the git checkout command 
 in `brew --prefix` directory.
 
 I am using llvm 3.2 because I had a few ghc related problems with llvm 3.3.
 Never had any problems with 3.2 though.
 
 Hope this helps,
 Ozgur
 

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


[Haskell-cafe] llvm on macos

2013-08-10 Thread Dominic Steinitz
I am trying to use llvm but am being told I don't have llvm installed.

Dominics-MacBook-Pro:Laplace dom$ ghc src-repa/Main.hs -rtsopts -threaded 
-eventlog -Odph -fllvm -optlo-O3 -fno-liberate-case -isrc-repa
[1 of 3] Compiling SolverStencil( src-repa/SolverStencil.hs, 
src-repa/SolverStencil.o )
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Loading package pretty-1.1.1.0 ... linking ... done.
Loading package array-0.4.0.1 ... linking ... done.
Loading package deepseq-1.3.0.1 ... linking ... done.
Loading package containers-0.5.0.0 ... linking ... done.
Loading package old-locale-1.0.0.5 ... linking ... done.
Loading package time-1.4.0.1 ... linking ... done.
Loading package random-1.0.1.1 ... linking ... done.
Loading package template-haskell ... linking ... done.
Loading package QuickCheck-2.5.1.1 ... linking ... done.
Loading package bytestring-0.10.0.2 ... linking ... done.
Loading package primitive-0.5.0.1 ... linking ... done.
Loading package vector-0.10.0.1 ... linking ... done.
Loading package repa-3.2.3.1 ... linking ... done.

no location info:
Warning: Couldn't figure out LLVM version!
 Make sure you have installed LLVM
ghc: could not execute: opt

The ghc documentation
(http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/code-generators.html)
says that llvm and clang are installed by default for 10.6 and
later. I am on 10.8.3.

Indeed

Dominics-MacBook-Pro:Laplace dom$ llvm-
llvm-cpp-4.2  llvm-g++  llvm-g++-4.2  llvm-gcc  llvm-gcc-4.2

And

Dominics-MacBook-Pro:Laplace dom$ clang
clangclang++  

But ghc-info tells me

Dominics-MacBook-Pro:Laplace dom$ ghc --info
 [(Project name,The Glorious Glasgow Haskell Compilation System)
 ,(GCC extra via C opts, -fwrapv)
 ,(C compiler command,/usr/bin/gcc)
 ,(C compiler flags, -m64 -fno-stack-protector  -m64)
 ,(ar command,/usr/bin/ar)
 ,(ar flags,clqs)
 ,(ar supports at file,@ArSupportsAtFile@)
 ,(touch command,touch)
 ,(dllwrap command,/bin/false)
 ,(windres command,/bin/false)
 ,(perl command,/usr/bin/perl)
 ,(target os,OSDarwin)
 ,(target arch,ArchX86_64)
 ,(target word size,8)
 ,(target has GNU nonexec stack,False)
 ,(target has .ident directive,True)
 ,(target has subsections via symbols,True)
 ,(LLVM llc command,llc)
 ,(LLVM opt command,opt)
 ,(Project version,7.6.2)
 ,(Booter version,7.4.2)
 ,(Stage,2)
 ,(Build platform,x86_64-apple-darwin)
 ,(Host platform,x86_64-apple-darwin)
 ,(Target platform,x86_64-apple-darwin)
 ,(Have interpreter,YES)
 ,(Object splitting supported,YES)
 ,(Have native code generator,YES)
 ,(Support SMP,YES)
 ,(Unregisterised,NO)
 ,(Tables next to code,YES)
 ,(RTS ways,l debug  thr thr_debug thr_l thr_p dyn debug_dyn thr_dyn 
thr_debug_dyn)
 ,(Leading underscore,YES)
 ,(Debug on,False)
 ,(LibDir,/usr/local/lib/ghc-7.6.2)
 ,(Global Package DB,/usr/local/lib/ghc-7.6.2/package.conf.d)
 ,(Gcc Linker flags,[\-m64\])
 ,(Ld Linker flags,[\-arch\,\x86_64\])
 ]

But I don't have either llc or opt

Dominics-MacBook-Pro:Laplace dom$ llc
-bash: llc: command not found
Dominics-MacBook-Pro:Laplace dom$ opt
-bash: opt: command not found
Dominics-MacBook-Pro:Laplace dom$ 

What is the solution?

Thanks,

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com


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


Re: [Haskell-cafe] llvm on macos

2013-08-10 Thread Dominic Steinitz
Thank you very much. I used Homebrew. Now I can compile albeit with a warning. 
I have yet to try running it.

 Loading package repa-3.2.3.1 ... linking ... done.
 You are using a new version of LLVM that hasn't been tested yet!
 We will try though...


Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 10 Aug 2013, at 16:36, Brandon Allbery allber...@gmail.com wrote:

 On Sat, Aug 10, 2013 at 7:39 AM, Dominic Steinitz domi...@steinitz.org 
 wrote:
 no location info:
 Warning: Couldn't figure out LLVM version!
  Make sure you have installed LLVM
 ghc: could not execute: opt
 
 The ghc documentation
 (http://www.haskell.org/ghc/docs/7.6.1/html/users_guide/code-generators.html)
 says that llvm and clang are installed by default for 10.6 and
 later. I am on 10.8.3.
 
 Apple *still* doesn't ship a full LLVM for some reason. I installed one via 
 MacPorts; Homebrew also has it. Maybe if enough people file bugs with Apple, 
 they'll start providing the whole thing instead of just the parts they use in 
 Xcode. :/
  
 -- 
 brandon s allbery kf8nh   sine nomine associates
 allber...@gmail.com  ballb...@sinenomine.net
 unix, openafs, kerberos, infrastructure, xmonadhttp://sinenomine.net

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


Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-06-05 Thread Dominic Steinitz
I will certainly volunteer (to mentor) next year if I feel I can add value.

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 2 Jun 2013, at 17:23, Edward Kmett ekm...@gmail.com wrote:

 Public good is a nebulous concept, but it is something that each of the folks 
 who sign up as mentors judges independently when they are rating the projects 
 and talking about them.
 
 Most of the folks who are offering to mentor have been involved in the 
 community for quite some time and have a pretty good overview of what is 
 going on, and what are currently active pain points.
 
 With 25 mentors we get a pretty good cross section of the community. We 
 aren't really able to canvas outside of the mentor group during the approval 
 process by google's guidelines, since we shouldn't leak information about 
 unaccepted projects. 
 
 Something like that uservoice site might be used to gauge public opinion of 
 general ideas before the proposals start coming in, but in the end students 
 write the proposals we get, so the things we would have polled about are 
 inevitably not quite what we're rating anyways. We rarely get something that 
 is just cut and pasted from the ideas list. Consequently a generic rating 
 that doesn't take into consideration the actual proposal isn't worth a whole 
 lot, beyond giving students an idea of what might be a successful proposal. 
 There is a lot of variability in the ratings for projects based simply on 
 what we know about the student, how clear the proposal is, and how achievable 
 his or her particular goals are.
 
 In practice, we've been able to make sure that a couple of slots go to 
 separable tasks in projects like cabal, haddock, and ghc that benefit 
 everyone and that exceptional one-off projects don't get shut out completely 
 just by asking each mentor to rate all of the projects, even the ones they 
 aren't interested in mentoring, and from the discussions between the mentors 
 and between the mentors and students that ensue within melange.
 
 My main advice is that if you want to get involved in the process, the 
 easiest way to peel back the curtain is to volunteer to mentor! We're 
 generally quite open to adding new voices to the discussion.
 
 -Edward
 
 
 
 
 On Sun, Jun 2, 2013 at 10:14 AM, Dominic Steinitz domi...@steinitz.org 
 wrote:
 Hi Edward,
 
 Thanks for this comprehensive answer (and also thanks to participants in the 
 follow-up dissuasion).
 
 How is the public good determined? (sounds rather Benthamite). I would have 
 been disappointed if charts using diagrams had not been selected yet I 
 don't recall being canvassed.
 
 Sorry to sound picky. I think from what you say that in this particular year 
 it was obvious which projects should be selected; in future it may not be. I 
 think an acceptable reason would be there was only one user who wanted it. 
 Maybe we should use something like: https://www.uservoice.com. Sadly it seems 
 this requires payment but there may be a free equivalent
 
 Dominic Steinitz
 domi...@steinitz.org
 http://idontgetoutmuch.wordpress.com
 
 On 28 May 2013, at 16:11, Edward Kmett ekm...@gmail.com wrote:
 
 Hi Dominic,
 
 The proposal is admittedly rather unfortunately opaque.
 
 The parts I can shed light on:
 
 Students come up with proposals with the help of the community and then 
 submit them to google-melange.com.
 
 A bunch of folks from the haskell community sign up as potential mentors, 
 vote on and discuss the proposals. (We had ~25 candidate mentors and ~20 
 proposals this year).
 
 The student application template contains a number of desirable criteria for 
 a successful summer of code application, which is shown on the 
 google-melange website under our organization -- an old version is available 
 http://hackage.haskell.org/trac/summer-of-code/wiki/StudApply2012 contains 
 
 Once we have the proposals in hand, and some initial ranking, we ask google 
 for slots. Allocation is based on past performance, arcane community 
 parameters that only they know, mentor ratio, etc. This should be our 
 largest year in the program, despite the fact that in general organizations 
 have been getting fewer slots as more organizations join, so we're 
 apparently doing rather well.
 
 In general we do try to select projects that maximize the public good. Most 
 of the time this can almost be done by just straight cut off based on the 
 average score. There is some special casing for duplicate applications 
 between different students and where students have submitted multiple 
 applications we can have some flexibility in how to apply them.
 
 This year we also received an extra couple of special-purpose darcs slots 
 from Google in exchange for continuing to act as an umbrella organization 
 over darcs at the request of the administrator of the program at Google. In 
 previous years I had requested an extra slot for them, this year the request 
 came in the other direction.
 
 We do inevitably

Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-06-02 Thread Dominic Steinitz
Hi Edward,

Thanks for this comprehensive answer (and also thanks to participants in the 
follow-up dissuasion).

How is the public good determined? (sounds rather Benthamite). I would have 
been disappointed if charts using diagrams had not been selected yet I don't 
recall being canvassed.

Sorry to sound picky. I think from what you say that in this particular year it 
was obvious which projects should be selected; in future it may not be. I think 
an acceptable reason would be there was only one user who wanted it. Maybe we 
should use something like: https://www.uservoice.com. Sadly it seems this 
requires payment but there may be a free equivalent

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com

On 28 May 2013, at 16:11, Edward Kmett ekm...@gmail.com wrote:

 Hi Dominic,
 
 The proposal is admittedly rather unfortunately opaque.
 
 The parts I can shed light on:
 
 Students come up with proposals with the help of the community and then 
 submit them to google-melange.com.
 
 A bunch of folks from the haskell community sign up as potential mentors, 
 vote on and discuss the proposals. (We had ~25 candidate mentors and ~20 
 proposals this year).
 
 The student application template contains a number of desirable criteria for 
 a successful summer of code application, which is shown on the google-melange 
 website under our organization -- an old version is available 
 http://hackage.haskell.org/trac/summer-of-code/wiki/StudApply2012 contains 
 
 Once we have the proposals in hand, and some initial ranking, we ask google 
 for slots. Allocation is based on past performance, arcane community 
 parameters that only they know, mentor ratio, etc. This should be our largest 
 year in the program, despite the fact that in general organizations have been 
 getting fewer slots as more organizations join, so we're apparently doing 
 rather well.
 
 In general we do try to select projects that maximize the public good. Most 
 of the time this can almost be done by just straight cut off based on the 
 average score. There is some special casing for duplicate applications 
 between different students and where students have submitted multiple 
 applications we can have some flexibility in how to apply them.
 
 This year we also received an extra couple of special-purpose darcs slots 
 from Google in exchange for continuing to act as an umbrella organization 
 over darcs at the request of the administrator of the program at Google. In 
 previous years I had requested an extra slot for them, this year the request 
 came in the other direction.
 
 We do inevitably get more good proposals than we get slots. This year we 
 could have easily used another 3-4 slots to good effect.
 
 The main part I can't shed light on:
 
 Google requests that the final vote tallies remain private. This is done so 
 that students who put in proposals to a high volume orgs and don't get 
 accepted, or who are new to the process and don't quite catch all the rules, 
 don't wind up with any sort of publicly visible black mark. This 
 unfortunately means, that we can't really show the unaccepted proposals with 
 information about how to avoid getting your proposal rejected.
 
 I hope that helps. If you have any more questions or if my answer didn't 
 suffice please feel free to follow up!
 
 -Edward Kmett
 
 
 
 On Tue, May 28, 2013 at 6:52 AM, Dominic Steinitz domi...@steinitz.org 
 wrote:
 Hi Edward,
 
 Although the project I am interested in (as a user) has been accepted :-), I 
 can't help feeling the selection process is a bit opaque. Is it documented 
 somewhere and I just missed it? Apologies if I did.
 
 BTW I appreciate all the hard work that goes into the selection process.
 
 Dominic Steinitz
 domi...@steinitz.org
 http://idontgetoutmuch.wordpress.com
 
 

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


Re: [Haskell-cafe] [haskell.org Google Summer of Code 2013] Approved Projects

2013-05-28 Thread Dominic Steinitz
Hi Edward,

Although the project I am interested in (as a user) has been accepted :-), I 
can't help feeling the selection process is a bit opaque. Is it documented 
somewhere and I just missed it? Apologies if I did.

BTW I appreciate all the hard work that goes into the selection process.

Dominic Steinitz
domi...@steinitz.org
http://idontgetoutmuch.wordpress.com


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


[Haskell-cafe] What is the process for GSOC?

2013-05-01 Thread Dominic Steinitz
How is it decided which Haskell projects get chosen? Do we discuss them here 
and take a collective view?

Thanks, Dominic.

PS I should point out I have an interest in the proposal to port charts to use 
diagrams 
(http://www.google-melange.com/gsoc/proposal/review/google/gsoc2013/jbracker/1) 
i.e. I'd really like this as a user.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Automated Differentiation Type Question

2013-04-23 Thread Dominic Steinitz
Can anyone tell me why I get a type error with testGrad2? What are my options? 
Clearly I would like to be able find the gradient of my cost function for 
different sets of observations.

Thanks, Dominic.

 {-# LANGUAGE NoMonomorphismRestriction #-}
 
 import Numeric.AD
 
 default()
 
 costFn :: Floating a = [a] - [[a]] - [a] - a
 costFn ys xss thetas = (/ (2*m)) $ sum $ map (^ (2 :: Int)) $
zipWith (\y xs - costFnAux y xs thetas) ys xss
   where
 m = fromIntegral $ length xss
 costFnAux :: Floating a = a - [a] - [a] - a
 costFnAux y xs thetas = y - head thetas - sum (zipWith (*) xs (tail 
 thetas))
 
 ys :: Floating a = [a]
 ys = [1.0, 2.0, 3.0]
 
 xss :: Floating a = [[a]]
 xss = [[1.0], [2.0], [3.0]]
 
 thetas :: Floating a = [a]
 thetas = [0.0, 1.0]
 
 test :: Floating a = a
 test = costFn ys xss thetas
 
 testGrad0 = grad (costFn ys xss)
 
 testGrad1 :: Floating a = [a] - [[a]] - [a] - [a]
 testGrad1 ys xss = grad (costFn (undefined :: Floating a = [a]) (undefined 
 :: Floating a = [[a]]))
 
 testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
 testGrad2 ys xss = grad (costFn ys xss)

 [1 of 1] Compiling Main ( 
 /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs, interpreted )
 
 /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:33:
 Could not deduce (a ~ ad-3.4:Numeric.AD.Internal.Types.AD s a)
 from the context (Floating a)
   bound by the type signature for
  testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
   at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14-53
 or from (Numeric.AD.Internal.Classes.Mode s)
   bound by a type expected by the context:
  Numeric.AD.Internal.Classes.Mode s =
  [ad-3.4:Numeric.AD.Internal.Types.AD s a]
  - ad-3.4:Numeric.AD.Internal.Types.AD s a
   at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:20-39
   `a' is a rigid type variable bound by
   the type signature for
 testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
   at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14
 Expected type: [ad-3.4:Numeric.AD.Internal.Types.AD s a]
   Actual type: [a]
 In the first argument of `costFn', namely `ys'
 In the first argument of `grad', namely `(costFn ys xss)'
 In the expression: grad (costFn ys xss)
 
 /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:36:
 Could not deduce (a ~ ad-3.4:Numeric.AD.Internal.Types.AD s a)
 from the context (Floating a)
   bound by the type signature for
  testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
   at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14-53
 or from (Numeric.AD.Internal.Classes.Mode s)
   bound by a type expected by the context:
  Numeric.AD.Internal.Classes.Mode s =
  [ad-3.4:Numeric.AD.Internal.Types.AD s a]
  - ad-3.4:Numeric.AD.Internal.Types.AD s a
   at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:20-39
   `a' is a rigid type variable bound by
   the type signature for
 testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
   at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14
 Expected type: [[ad-3.4:Numeric.AD.Internal.Types.AD s a]]
   Actual type: [[a]]
 In the second argument of `costFn', namely `xss'
 In the first argument of `grad', namely `(costFn ys xss)'
 In the expression: grad (costFn ys xss)
 Failed, modules loaded: none.



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


Re: [Haskell-cafe] Automated Differentiation Type Question

2013-04-23 Thread Dominic Steinitz
Answering my own question, what I needed was:

testGrad2 :: (Fractional a, Num a) =
 (forall s . Mode s = [AD s a]) -
 (forall s . Mode s = [[AD s a]]) -
 [a] - [a]
testGrad2 ys xss = grad (costFn ys xss)


On 23 Apr 2013, at 10:44, Dominic Steinitz domi...@steinitz.org wrote:

 Can anyone tell me why I get a type error with testGrad2? What are my 
 options? Clearly I would like to be able find the gradient of my cost 
 function for different sets of observations.
 
 Thanks, Dominic.
 
 {-# LANGUAGE NoMonomorphismRestriction #-}
 
 import Numeric.AD
 
 default()
 
 costFn :: Floating a = [a] - [[a]] - [a] - a
 costFn ys xss thetas = (/ (2*m)) $ sum $ map (^ (2 :: Int)) $
   zipWith (\y xs - costFnAux y xs thetas) ys xss
  where
m = fromIntegral $ length xss
costFnAux :: Floating a = a - [a] - [a] - a
costFnAux y xs thetas = y - head thetas - sum (zipWith (*) xs (tail 
 thetas))
 
 ys :: Floating a = [a]
 ys = [1.0, 2.0, 3.0]
 
 xss :: Floating a = [[a]]
 xss = [[1.0], [2.0], [3.0]]
 
 thetas :: Floating a = [a]
 thetas = [0.0, 1.0]
 
 test :: Floating a = a
 test = costFn ys xss thetas
 
 testGrad0 = grad (costFn ys xss)
 
 testGrad1 :: Floating a = [a] - [[a]] - [a] - [a]
 testGrad1 ys xss = grad (costFn (undefined :: Floating a = [a]) (undefined 
 :: Floating a = [[a]]))
 
 testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
 testGrad2 ys xss = grad (costFn ys xss)
 
 [1 of 1] Compiling Main ( 
 /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs, interpreted )
 
 /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:33:
Could not deduce (a ~ ad-3.4:Numeric.AD.Internal.Types.AD s a)
from the context (Floating a)
  bound by the type signature for
 testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
  at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14-53
or from (Numeric.AD.Internal.Classes.Mode s)
  bound by a type expected by the context:
 Numeric.AD.Internal.Classes.Mode s =
 [ad-3.4:Numeric.AD.Internal.Types.AD s a]
 - ad-3.4:Numeric.AD.Internal.Types.AD s a
  at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:20-39
  `a' is a rigid type variable bound by
  the type signature for
testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
  at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14
Expected type: [ad-3.4:Numeric.AD.Internal.Types.AD s a]
  Actual type: [a]
In the first argument of `costFn', namely `ys'
In the first argument of `grad', namely `(costFn ys xss)'
In the expression: grad (costFn ys xss)
 
 /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:36:
Could not deduce (a ~ ad-3.4:Numeric.AD.Internal.Types.AD s a)
from the context (Floating a)
  bound by the type signature for
 testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
  at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14-53
or from (Numeric.AD.Internal.Classes.Mode s)
  bound by a type expected by the context:
 Numeric.AD.Internal.Classes.Mode s =
 [ad-3.4:Numeric.AD.Internal.Types.AD s a]
 - ad-3.4:Numeric.AD.Internal.Types.AD s a
  at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:33:20-39
  `a' is a rigid type variable bound by
  the type signature for
testGrad2 :: Floating a = [a] - [[a]] - [a] - [a]
  at /Users/dom/Dropbox/Private/Whales/ADTypePuzzle.hs:32:14
Expected type: [[ad-3.4:Numeric.AD.Internal.Types.AD s a]]
  Actual type: [[a]]
In the second argument of `costFn', namely `xss'
In the first argument of `grad', namely `(costFn ys xss)'
In the expression: grad (costFn ys xss)
 Failed, modules loaded: none.
 
 


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


Re: [Haskell-cafe] Automated Differentiation of Matrices (hmatrix)

2013-04-10 Thread Dominic Steinitz
Hi Edward,

Thanks for the response. For now I don't need the performance for now but it's 
good to know these developments are in the pipeline. I'm not wedded to hmatrix. 
I think I could use repa or yarr just as easily; I just haven't investigated.

Dominic.

On 9 Apr 2013, at 23:03, Edward Kmett ekm...@gmail.com wrote:

 hmatrix and ad don't (currently) mix.
 
 The problem is that hmatrix uses a packed structure that can't hold any of 
 the AD mode variants we have as an Element. =(
 
 I've been working with Alex Lang to explore in ad 4.0 ways that we can 
 support monomorphic AD modes and still present largely the same API. We've 
 seen a number of performance gains off of this refactoring already, but it 
 doesn't go far enough to address what you need.
 
 A goal a bit farther out is to support AD on vector/matrix operations, but it 
 is a much bigger refactoring than the one currently in the pipeline. =/
 
 To support automatic differentiation on vector-based operations in a form 
 that works with standard BLAS-like storage like the packed matrix rep used in 
 hmatrix we need to convert from a 'matrix of AD variables' to an 'AD mode 
 over of matrices'. This is similar to the difference between a matrix of 
 complex numbers and a real matrix plus an imaginary matrix.
 
 This is a long term goal, but not one you're likely to see support for out of 
 'ad' in the short term.
 
 I can't build AD on hmatrix itself due in part to licensing restrictions and 
 differing underlying storage requirements, so there are a lot of little 
 issues in making that latter vision a reality.
 
 -Edward
 
 
 On Tue, Apr 9, 2013 at 10:46 AM, Dominic Steinitz domi...@steinitz.org 
 wrote:
 Hi Cafe,
 
 Suppose I want to find the grad of a function then it's easy I just
 use http://hackage.haskell.org/package/ad-3.4:
 
 import Numeric.AD
 import Data.Foldable (Foldable)
 import Data.Traversable (Traversable)
 
 data MyMatrix a = MyMatrix (a, a)
   deriving (Show, Functor, Foldable, Traversable)
 
 f :: Floating a = MyMatrix a - a
 f (MyMatrix (x, y)) = exp $ negate $ (x^2 + y^2) / 2.0
 
 main :: IO ()
 main = do
   putStrLn $ show $ f $ MyMatrix (0.0, 0.0)
   putStrLn $ show $ grad f $ MyMatrix (0.0, 0.0)
 
 But now suppose I am doing some matrix calculations
 http://hackage.haskell.org/package/hmatrix-0.14.1.0 and I want to find
 the grad of a function of a matrix:
 
 import Numeric.AD
 import Numeric.LinearAlgebra
 import Data.Foldable (Foldable)
 import Data.Traversable (Traversable)
 
 g :: (Element a, Floating a) = Matrix a - a
 g m = exp $ negate $ (x^2 + y^2) / 2.0
   where r = (toLists m)!!0
 x = r!!0
 y = r!!1
 
 main :: IO ()
 main = do
   putStrLn $ show $ g $ (1  2) ([0.0, 0.0] :: [Double])
   putStrLn $ show $ grad g $ (1  2) ([0.0, 0.0] :: [Double])
 
 Then I am in trouble:
 
 /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21:
 No instance for (Traversable Matrix) arising from a use of `grad'
 Possible fix: add an instance declaration for (Traversable Matrix)
 In the expression: grad g
 In the second argument of `($)', namely
   `grad g $ (1  2) ([0.0, 0.0] :: [Double])'
 In the second argument of `($)', namely
   `show $ grad g $ (1  2) ([0.0, 0.0] :: [Double])'
 
 /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:26:
 Could not deduce (Element
 (ad-3.4:Numeric.AD.Internal.Types.AD s Double))
   arising from a use of `g'
 from the context (Numeric.AD.Internal.Classes.Mode s)
   bound by a type expected by the context:
  Numeric.AD.Internal.Classes.Mode s =
  Matrix (ad-3.4:Numeric.AD.Internal.Types.AD s Double)
  - ad-3.4:Numeric.AD.Internal.Types.AD s Double
   at /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21-26
 Possible fix:
   add an instance declaration for
   (Element (ad-3.4:Numeric.AD.Internal.Types.AD s Double))
 In the first argument of `grad', namely `g'
 In the expression: grad g
 In the second argument of `($)', namely
   `grad g $ (1  2) ([0.0, 0.0] :: [Double])'
 
 What are my options here? Clearly I can convert my matrix into a list
 (which is traversable), find the grad and convert it back into a
 matrix but given I am doing numerical calculations and speed is an
 important factor, this seems undesirable.
 
 I think I would have the same problem with:
 
 http://hackage.haskell.org/package/repa
 http://hackage.haskell.org/package/yarr-1.3.1
 
 although I haven'¯t checked.
 
 Thanks, Dominic.
 
 
 ___
 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] Automated Differentiation of Matrices (hmatrix)

2013-04-10 Thread Dominic Steinitz
Hi Edward,

I see now that the issues are deeper than performance.

I took another package that supports matrix operations: repa.

 data MyMatrix a = MyMatrix
   {
 myRows :: Int
   , myCols :: Int
   , myElts :: [a]
   } deriving (Show, Functor, Foldable, Traversable)
 
 f (MyMatrix r c es) = sum es
 
 g (MyMatrix r c es) = head $ toList $ sumS $ sumS n
   where
 n   = fromListUnboxed (Z :. r :. c) es


I can take the grad of f but not of g even though they are the same function:

 *Main :t grad f
 grad f :: Num a = MyMatrix a - MyMatrix a
 *Main :t grad g
 
 interactive:1:6:
 Could not deduce (repa-3.2.3.1:Data.Array.Repa.Eval.Elt.Elt
 (ad-3.4:Numeric.AD.Internal.Types.AD s a))
   arising from a use of `g'
 from the context (Num a)
   bound by the inferred type of
it :: Num a = MyMatrix a - MyMatrix a
   at Top level
 or from (Numeric.AD.Internal.Classes.Mode s)
   bound by a type expected by the context:
  Numeric.AD.Internal.Classes.Mode s =
  MyMatrix (ad-3.4:Numeric.AD.Internal.Types.AD s a)
  - ad-3.4:Numeric.AD.Internal.Types.AD s a
   at interactive:1:1-6
 Possible fix:
   add an instance declaration for
   (repa-3.2.3.1:Data.Array.Repa.Eval.Elt.Elt
  (ad-3.4:Numeric.AD.Internal.Types.AD s a))
 In the first argument of `grad', namely `g'
 In the expression: grad g


2. By monomorphic, do you mean that I can do:

 g :: MyMatrix Double - Double
 g (MyMatrix r c es) = head $ toList $ sumS $ sumS n
   where
 n   = fromListUnboxed (Z :. r :. c) es


but not get a type error as I currently do:

 *Main :t grad g
 
 interactive:1:6:
 Couldn't match type `Double'
   with `ad-3.4:Numeric.AD.Internal.Types.AD s a0'
 Expected type: MyMatrix (ad-3.4:Numeric.AD.Internal.Types.AD s a0)
- ad-3.4:Numeric.AD.Internal.Types.AD s a0
   Actual type: MyMatrix Double - Double
 In the first argument of `grad', namely `g'
 In the expression: grad g


If so that would help as at least I could then convert between e.g. repa and 
structures that ad can play with. Of course, better would be that I could just 
apply ad to e.g. repa.

Dominic.

On 9 Apr 2013, at 23:03, Edward Kmett ekm...@gmail.com wrote:

 hmatrix and ad don't (currently) mix.
 
 The problem is that hmatrix uses a packed structure that can't hold any of 
 the AD mode variants we have as an Element. =(
 
 I've been working with Alex Lang to explore in ad 4.0 ways that we can 
 support monomorphic AD modes and still present largely the same API. We've 
 seen a number of performance gains off of this refactoring already, but it 
 doesn't go far enough to address what you need.
 
 A goal a bit farther out is to support AD on vector/matrix operations, but it 
 is a much bigger refactoring than the one currently in the pipeline. =/
 
 To support automatic differentiation on vector-based operations in a form 
 that works with standard BLAS-like storage like the packed matrix rep used in 
 hmatrix we need to convert from a 'matrix of AD variables' to an 'AD mode 
 over of matrices'. This is similar to the difference between a matrix of 
 complex numbers and a real matrix plus an imaginary matrix.
 
 This is a long term goal, but not one you're likely to see support for out of 
 'ad' in the short term.
 
 I can't build AD on hmatrix itself due in part to licensing restrictions and 
 differing underlying storage requirements, so there are a lot of little 
 issues in making that latter vision a reality.
 
 -Edward
 
 
 On Tue, Apr 9, 2013 at 10:46 AM, Dominic Steinitz domi...@steinitz.org 
 wrote:
 Hi Cafe,
 
 Suppose I want to find the grad of a function then it's easy I just
 use http://hackage.haskell.org/package/ad-3.4:
 
 import Numeric.AD
 import Data.Foldable (Foldable)
 import Data.Traversable (Traversable)
 
 data MyMatrix a = MyMatrix (a, a)
   deriving (Show, Functor, Foldable, Traversable)
 
 f :: Floating a = MyMatrix a - a
 f (MyMatrix (x, y)) = exp $ negate $ (x^2 + y^2) / 2.0
 
 main :: IO ()
 main = do
   putStrLn $ show $ f $ MyMatrix (0.0, 0.0)
   putStrLn $ show $ grad f $ MyMatrix (0.0, 0.0)
 
 But now suppose I am doing some matrix calculations
 http://hackage.haskell.org/package/hmatrix-0.14.1.0 and I want to find
 the grad of a function of a matrix:
 
 import Numeric.AD
 import Numeric.LinearAlgebra
 import Data.Foldable (Foldable)
 import Data.Traversable (Traversable)
 
 g :: (Element a, Floating a) = Matrix a - a
 g m = exp $ negate $ (x^2 + y^2) / 2.0
   where r = (toLists m)!!0
 x = r!!0
 y = r!!1
 
 main :: IO ()
 main = do
   putStrLn $ show $ g $ (1  2) ([0.0, 0.0] :: [Double])
   putStrLn $ show $ grad g $ (1  2) ([0.0, 0.0] :: [Double])
 
 Then I am in trouble:
 
 /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21:
 No instance for (Traversable Matrix) arising from a use of `grad'
 Possible fix: add

[Haskell-cafe] Automated Differentiation of Matrices (hmatrix)

2013-04-09 Thread Dominic Steinitz
Hi Cafe,

Suppose I want to find the grad of a function then it's easy I just
use http://hackage.haskell.org/package/ad-3.4:

import Numeric.AD
import Data.Foldable (Foldable)
import Data.Traversable (Traversable)

data MyMatrix a = MyMatrix (a, a)
  deriving (Show, Functor, Foldable, Traversable)

f :: Floating a = MyMatrix a - a
f (MyMatrix (x, y)) = exp $ negate $ (x^2 + y^2) / 2.0

main :: IO ()
main = do
  putStrLn $ show $ f $ MyMatrix (0.0, 0.0)
  putStrLn $ show $ grad f $ MyMatrix (0.0, 0.0)

But now suppose I am doing some matrix calculations
http://hackage.haskell.org/package/hmatrix-0.14.1.0 and I want to find
the grad of a function of a matrix:

import Numeric.AD
import Numeric.LinearAlgebra
import Data.Foldable (Foldable)
import Data.Traversable (Traversable)

g :: (Element a, Floating a) = Matrix a - a
g m = exp $ negate $ (x^2 + y^2) / 2.0
  where r = (toLists m)!!0
x = r!!0
y = r!!1

main :: IO ()
main = do
  putStrLn $ show $ g $ (1  2) ([0.0, 0.0] :: [Double])
  putStrLn $ show $ grad g $ (1  2) ([0.0, 0.0] :: [Double])

Then I am in trouble:

/Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21:
No instance for (Traversable Matrix) arising from a use of `grad'
Possible fix: add an instance declaration for (Traversable Matrix)
In the expression: grad g
In the second argument of `($)', namely
  `grad g $ (1  2) ([0.0, 0.0] :: [Double])'
In the second argument of `($)', namely
  `show $ grad g $ (1  2) ([0.0, 0.0] :: [Double])'

/Users/dom/Dropbox/Private/Whales/MyAD.hs:24:26:
Could not deduce (Element
(ad-3.4:Numeric.AD.Internal.Types.AD s Double))
  arising from a use of `g'
from the context (Numeric.AD.Internal.Classes.Mode s)
  bound by a type expected by the context:
 Numeric.AD.Internal.Classes.Mode s =
 Matrix (ad-3.4:Numeric.AD.Internal.Types.AD s Double)
 - ad-3.4:Numeric.AD.Internal.Types.AD s Double
  at /Users/dom/Dropbox/Private/Whales/MyAD.hs:24:21-26
Possible fix:
  add an instance declaration for
  (Element (ad-3.4:Numeric.AD.Internal.Types.AD s Double))
In the first argument of `grad', namely `g'
In the expression: grad g
In the second argument of `($)', namely
  `grad g $ (1  2) ([0.0, 0.0] :: [Double])'

What are my options here? Clearly I can convert my matrix into a list
(which is traversable), find the grad and convert it back into a
matrix but given I am doing numerical calculations and speed is an
important factor, this seems undesirable.

I think I would have the same problem with:

http://hackage.haskell.org/package/repa
http://hackage.haskell.org/package/yarr-1.3.1

although I haven'¯t checked.

Thanks, Dominic.


___
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-04-03 Thread Dominic Steinitz
Cool! Works for me. Many thanks, Dominic

On 3 Apr 2013, at 12:40, Edsko de Vries edskodevr...@gmail.com wrote:

 I provide a ThreadScope binary on my site 
 (http://www.edsko.net/2013/01/24/threadscope-0-2-2/) which runs fine for me 
 on 10.8.3.
 
 -E
 
 
 On Mon, Apr 1, 2013 at 8:01 AM, Dominic Steinitz domi...@steinitz.org wrote:
 Alfredo Di Napoli alfredo.dinapoli at gmail.com writes:
 
 
  Said that,has someone had any luck in running Threadscope on Mac OS X 10.8 
  at all?
 
  Thanks,
  A.
 
 
 I think I have encountered the same problem:
 
 https://groups.google.com/d/msg/parallel-haskell/-lhrgNN8elw/KzqLM9BzoJwJ
 
 In my experience, anything that uses gtk is a problem on a MAC.
 
 I still intend to do some analysis *not* using threadscope but using 
 event-logs directly
 but that is at least a few weeks away.
 
 Dominic.
 ___
 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] Threadscope 0.2.2 goes in segmentation fault on Mac Os X 10.8.3

2013-04-01 Thread Dominic Steinitz
Alfredo Di Napoli alfredo.dinapoli at gmail.com writes:

 
 Said that,has someone had any luck in running Threadscope on Mac OS X 10.8 at 
 all?
 
 Thanks,
 A.
 

I think I have encountered the same problem:

https://groups.google.com/d/msg/parallel-haskell/-lhrgNN8elw/KzqLM9BzoJwJ

In my experience, anything that uses gtk is a problem on a MAC.

I still intend to do some analysis *not* using threadscope but using event-logs 
directly
but that is at least a few weeks away.

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


Problems installing 7.6.2 on MACOS

2013-03-27 Thread Dominic Steinitz
Hi,

I followed the instructions pointed to from here: 
http://www.haskell.org/ghc/download_ghc_7_6_2#macosx_x86_64

 bash-3.2$ ./configure --prefix=/Library/Haskell


 bash-3.2$ sudo make install


But sadly I get:

 bash-3.2$ ghc-pkg list
 ghc-pkg: missing --global-package-db option, location of global package 
 database unknown


and

 bash-3.2$ ghc --make nnClassifier.lhs -O2
 ghc: missing -Bdir option


Any advice on how to get 7.6.2 working would be much appreciated.

Dominic.

Here's some more information:

 bash-3.2$ which ghc-pkg
 /Library/Haskell/lib/ghc-7.6.2/ghc-pkg
 bash-3.2$ which ghc
 /Library/Haskell/lib/ghc-7.6.2/ghc

7.4.1 still works fine:

 bash-3.2$ ghc-pkg-7.4.1 list
 /Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/lib/ghc-7.4.1/package.conf.d:
 Cabal-1.14.0
 GLUT-2.1.2.1


 bash-3.2$ ghc-7.4.1 --make nnClassifier.lhs -O2 -fforce-recomp
 [1 of 6] Compiling MatrixPlus   ( MatrixPlus.hs, MatrixPlus.o )
 [2 of 6] Compiling NeuralNet( NeuralNet.hs, NeuralNet.o )
 [3 of 6] Compiling Backprop ( Backprop.hs, Backprop.o )
 [4 of 6] Compiling MarineExplore( MarineExplore.hs, MarineExplore.o )
 [5 of 6] Compiling Runner   ( Runner.hs, Runner.o )
 [6 of 6] Compiling Main ( nnClassifier.lhs, nnClassifier.o )
 Linking nnClassifier ...
 ld: warning: directory not found for option '-L/opt/local/lib/'
 bash-3.2$ ./nnClassifier 
 Reading training labels...
 Read 100 labels[(1,0),(2,1),(3,0),(4,1),(5,0),(6,0),(7,1),(8,0),(9,1),(10,0)]
 Reading training images...
 9:9
 9:9



___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: Problems installing 7.6.2 on MACOS

2013-03-27 Thread Dominic Steinitz
Answering my own question: it seems I made a rookie mistake and specified 
--prefix=/Library/Haskell which is where 7.4.1 lives. I just specified 
--prefix=/usr/lib and as far as I can tell everything works.

On 27 Mar 2013, at 11:40, Dominic Steinitz domi...@steinitz.org wrote:

 Hi,
 
 I followed the instructions pointed to from here: 
 http://www.haskell.org/ghc/download_ghc_7_6_2#macosx_x86_64
 
 bash-3.2$ ./configure --prefix=/Library/Haskell
 
 
 bash-3.2$ sudo make install
 
 
 But sadly I get:
 
 bash-3.2$ ghc-pkg list
 ghc-pkg: missing --global-package-db option, location of global package 
 database unknown
 
 
 and
 
 bash-3.2$ ghc --make nnClassifier.lhs -O2
 ghc: missing -Bdir option
 
 
 Any advice on how to get 7.6.2 working would be much appreciated.
 
 Dominic.
 
 Here's some more information:
 
 bash-3.2$ which ghc-pkg
 /Library/Haskell/lib/ghc-7.6.2/ghc-pkg
 bash-3.2$ which ghc
 /Library/Haskell/lib/ghc-7.6.2/ghc
 
 7.4.1 still works fine:
 
 bash-3.2$ ghc-pkg-7.4.1 list
 /Library/Frameworks/GHC.framework/Versions/7.4.1-x86_64/usr/lib/ghc-7.4.1/package.conf.d:
Cabal-1.14.0
GLUT-2.1.2.1
 
 
 bash-3.2$ ghc-7.4.1 --make nnClassifier.lhs -O2 -fforce-recomp
 [1 of 6] Compiling MatrixPlus   ( MatrixPlus.hs, MatrixPlus.o )
 [2 of 6] Compiling NeuralNet( NeuralNet.hs, NeuralNet.o )
 [3 of 6] Compiling Backprop ( Backprop.hs, Backprop.o )
 [4 of 6] Compiling MarineExplore( MarineExplore.hs, MarineExplore.o )
 [5 of 6] Compiling Runner   ( Runner.hs, Runner.o )
 [6 of 6] Compiling Main ( nnClassifier.lhs, nnClassifier.o )
 Linking nnClassifier ...
 ld: warning: directory not found for option '-L/opt/local/lib/'
 bash-3.2$ ./nnClassifier 
 Reading training labels...
 Read 100 labels[(1,0),(2,1),(3,0),(4,1),(5,0),(6,0),(7,1),(8,0),(9,1),(10,0)]
 Reading training images...
 9:9
 9:9
 
 


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] Optimization flag changing result of code execution

2013-03-17 Thread Dominic Steinitz
Aleksey Khudyakov alexey.skladnoy at gmail.com writes:

 I've tried to run you program and I've got approximately same results 
 regardless of optimization level. Which versions of GHC, mwc-random, 
 vector and primitive do you use?
 

By approximate do you mean you are getting Monte Carlo noise
or Floating Point noise? If the latter then that's reasonable;
if the former then that's worrying.

Dominic.



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


Re: [Haskell-cafe] Repa: traverse delayed array multiple times

2013-01-14 Thread Dominic Steinitz
Andrey Yankin yankin013 at gmail.com writes:

 
 
 Greetings to all!
 
repa?I wrote this rough sketch that shows what I am into. Apparently, program 
is severely slow. I think reason is:Every time an element is requested from a 
delayed array it is calculated
  anew, which means that delayed arrays are inefficient when the data is 
 needed multiple 
times(http://www.haskell.org/haskellwiki/Numeric_Haskell:_A_Repa_Tutorial).I 
started diving into Guiding Parallel Array Fusion with Indexed Types mentioned 
there. Is it a right place to find any answer to my question?
 

It's certainly possible to do this in repa. As I understand it, that is pretty 
much what repa is for. I'm not sure about your explanation for the slowdown 
although it sounds plausible.

I amended your code slightly and it runs pretty quickly for me using my 2 
processors!

updater :: Source r Int = Array r DIM2 Int - Array D DIM2 Int
updater a = traverse a id step

updaterM :: Monad m = Int - Array U DIM2 Int - m (Array U DIM2 Int)
updaterM n = foldr (=) return (replicate n (computeP . updater))

and replace

  g - computeP $ accumulate n grid :: IO (Array U DIM2 Int)

by

  g - updaterM n grid

BTW I think you can use stencils for what you are doing (I assume it is some 
sort of relaxation method) as the coefficients are constant. I think this 
should speed things up further as you won't be testing the boundary conditions 
on every loop.

Dominic.




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


Re: Is there a workaround for this bug?

2013-01-01 Thread Dominic Steinitz
Thanks - I'll probably wait for the next release.

On 1 Jan 2013, at 19:48, Simon Peyton-Jones simo...@microsoft.com wrote:

 I think the patch did get into 7.6.2 (which is about to be released) though.
 
 I don't think there's a workaround, except by not using External Core, or not 
 using Integer literals (use Ints?).  Sorry.
 
 Simon
 
 |  -Original Message-
 |  From: glasgow-haskell-users-boun...@haskell.org 
 [mailto:glasgow-haskell-users-
 |  boun...@haskell.org] On Behalf Of Dominic Steinitz
 |  Sent: 26 December 2012 18:14
 |  To: glasgow-haskell-users@haskell.org
 |  Subject: Is there a workaround for this bug?
 |  
 |  AFAICT this bug fix http://hackage.haskell.org/trac/ghc/ticket/7239 did 
 not make
 |  it into 7.6.1. Also I am happily working on the Haskell Platform with 
 7.4.1 and I'd
 |  rather avoid upgrading if possible.
 |  
 |  Is there a workaround? I've attached my code below along with the error 
 message
 |  (which is the same as in the above bug report). I'm rather hoping I won't 
 have to
 |  build HEAD.
 |  
 |  Thanks, Dominic.
 |  
 |  bash-3.2$ ghc -fext-core --make Test.hs
 |  [1 of 1] Compiling Main ( Test.hs, Test.o )
 |  ghc: panic! (the 'impossible' happened)
 |   (GHC version 7.4.1 for x86_64-apple-darwin):
 | MkExternalCore died: make_lit
 |  
 |  {-# LANGUAGE FlexibleContexts #-}
 |  
 |  {-# OPTIONS_GHC -Wall -fno-warn-name-shadowing -fno-warn-type-defaults #-}
 |  
 |  import Data.Array.Repa as Repa
 |  import Data.Array.Repa.Eval
 |  import Control.Monad
 |  
 |  r, sigma, k, t, xMax, deltaX, deltaT :: Double
 |  m, n :: Int
 |  r = 0.05
 |  sigma = 0.2
 |  k = 50.0
 |  t = 3.0
 |  m = 80
 |  xMax = 150
 |  deltaX = xMax / (fromIntegral m)
 |  n = 800
 |  deltaT = t / (fromIntegral n)
 |  
 |  data PointedArrayU a = PointedArrayU Int (Array U DIM1 a)
 |   deriving Show
 |  
 |  f :: PointedArrayU Double - Double
 |  f (PointedArrayU j _x) | j == 0 = 0.0
 |  f (PointedArrayU j _x) | j == m = xMax - k
 |  f (PointedArrayU j  x)  = a * x! (Z :. j-1) +
 |   b * x! (Z :. j) +
 |   c * x! (Z :. j+1)
 |   where
 | a = deltaT * (sigma^2 * (fromIntegral j)^2 - r * (fromIntegral j)) / 2
 | b = 1 - deltaT * (r  + sigma^2 * (fromIntegral j)^2)
 | c = deltaT * (sigma^2 * (fromIntegral j)^2 + r * (fromIntegral j)) / 2
 |  
 |  priceAtT :: PointedArrayU Double
 |  priceAtT = PointedArrayU 0 (fromListUnboxed (Z :. m+1)
 |[ max 0 (deltaX * (fromIntegral j) - k) | j - 
 [0..m] ])
 |  
 |  coBindU :: (Source U a, Source U b, Target U b, Monad m) =
 |PointedArrayU a - (PointedArrayU a - b) - m (PointedArrayU  b)
 |  coBindU (PointedArrayU i a) f = computeP newArr = return . PointedArrayU 
 i
 |   where
 |   newArr = traverse a id g
 | where
 |   g _get (Z :. j) = f $ PointedArrayU j a
 |  
 |  testN :: Int - IO (PointedArrayU Double)
 |  testN n =  h priceAtT
 |where
 |h = foldr (=) return
 |(take n $ Prelude.zipWith flip (repeat coBindU) (repeat f))
 |  
 |  main :: IO ()
 |  main = do r - testN n
 |   putStrLn $ show r
 |  
 |  
 |  ___
 |  Glasgow-haskell-users mailing list
 |  Glasgow-haskell-users@haskell.org
 |  http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Is there a workaround for this bug?

2012-12-26 Thread Dominic Steinitz
AFAICT this bug fix http://hackage.haskell.org/trac/ghc/ticket/7239 did not 
make it into 7.6.1. Also I am happily working on the Haskell Platform with 
7.4.1 and I'd rather avoid upgrading if possible.

Is there a workaround? I've attached my code below along with the error message 
(which is the same as in the above bug report). I'm rather hoping I won't have 
to build HEAD.

Thanks, Dominic.

bash-3.2$ ghc -fext-core --make Test.hs
[1 of 1] Compiling Main ( Test.hs, Test.o )
ghc: panic! (the 'impossible' happened)
 (GHC version 7.4.1 for x86_64-apple-darwin):
MkExternalCore died: make_lit

{-# LANGUAGE FlexibleContexts #-}

{-# OPTIONS_GHC -Wall -fno-warn-name-shadowing -fno-warn-type-defaults #-}

import Data.Array.Repa as Repa
import Data.Array.Repa.Eval
import Control.Monad

r, sigma, k, t, xMax, deltaX, deltaT :: Double
m, n :: Int
r = 0.05
sigma = 0.2
k = 50.0
t = 3.0
m = 80
xMax = 150
deltaX = xMax / (fromIntegral m)
n = 800
deltaT = t / (fromIntegral n)

data PointedArrayU a = PointedArrayU Int (Array U DIM1 a)
 deriving Show

f :: PointedArrayU Double - Double
f (PointedArrayU j _x) | j == 0 = 0.0
f (PointedArrayU j _x) | j == m = xMax - k
f (PointedArrayU j  x)  = a * x! (Z :. j-1) +
 b * x! (Z :. j) +
 c * x! (Z :. j+1)
 where
   a = deltaT * (sigma^2 * (fromIntegral j)^2 - r * (fromIntegral j)) / 2
   b = 1 - deltaT * (r  + sigma^2 * (fromIntegral j)^2)
   c = deltaT * (sigma^2 * (fromIntegral j)^2 + r * (fromIntegral j)) / 2

priceAtT :: PointedArrayU Double
priceAtT = PointedArrayU 0 (fromListUnboxed (Z :. m+1) 
  [ max 0 (deltaX * (fromIntegral j) - k) | j - [0..m] 
])

coBindU :: (Source U a, Source U b, Target U b, Monad m) =
  PointedArrayU a - (PointedArrayU a - b) - m (PointedArrayU  b)
coBindU (PointedArrayU i a) f = computeP newArr = return . PointedArrayU i
 where
 newArr = traverse a id g
   where
 g _get (Z :. j) = f $ PointedArrayU j a

testN :: Int - IO (PointedArrayU Double)
testN n =  h priceAtT
  where
  h = foldr (=) return
  (take n $ Prelude.zipWith flip (repeat coBindU) (repeat f))

main :: IO ()
main = do r - testN n
 putStrLn $ show r


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: [Haskell-cafe] Large, numerical calculations in Haskell

2012-12-12 Thread Dominic Steinitz
Emil Hedevang emilhedevang at gmail.com writes:

 
 
 Hi Haskell Cafe,
 
 I need to perform very large numerical computations requiring tens of GB of 
memory. The computations consist essentially of generation of random numbers 
and discrete convolutions of large arrays of random numbers with somewhat 
smaller kernel arrays. Should I use Haskell and call some C libraries when 
necessary? Should I just write everything in C? Or should I use e.g. Chapel 
(chapel.cray.com)?
 
 
Hi Emil,

The first place I would look would be repa http://repa.ouroborus.net/. IIRC it 
supports discrete convolutions and repa folks seem quite responsive.

Dominic.

PS I am planning to use repa to solve PDEs and address, at least 
partially, the curse of dimensionality with it.




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


Re: [Haskell-cafe] [repa] beginner questions

2012-11-18 Thread Dominic Steinitz
Dmitry Malikov malikov.d.y at gmail.com writes:

 
 Playing around with repa arrays and got some questions.
 
 1) How I can get list of indexes of array that suffice some predicate?
 
   a1
  AUnboxed (Z :. 3) (fromList [False,False,True])
  it :: Array U (Z :. Int) Bool
 
 Indexes of element that satisfying specific predicate could be obtained 
 like that:
 
   (\a p → Data.List.map (subtract 1 . snd) $ filter (p . fst) $ zip 
 (toList a) [1..]) a1 (== False)
  [0,1]
 
 Looks ugly. How REPA users used to do filtering like that without 
 converting to list?
 

I hope someone will correct me if I am wrong and furthermore I was not
entirely clear what you were trying to do but it seems to me that if you
want to filter out an unknown number of elements from a collection 
then repa is the wrong abstraction to use.

You can however filter out a known number of elements e.g.

xs = Repa.fromListUnboxed (Z :. 3) [1, 2, 3]

removeOne ix xs = Repa.fromFunction
   (Z :. dx - 1)
   (\(Z :. jx) - xs ! (Z :. f jx))
   where
 Z :. dx = Repa.extent xs
 f jx | jx  ix   = jx
   | otherwise = jx + 1

test = Repa.computeP $ removeOne 1 xs :: IO (Array U DIM1 Float)

Does that help?

Dominic.


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


Re: [Haskell-cafe] not enough fusion?

2012-06-27 Thread Dominic Steinitz
Duncan Coutts duncan.coutts at googlemail.com writes:

 This could in principle be fixed with an arity raising transformation,

Do you have a reference to arity raising transformations?

Thanks, Dominic.


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


[Haskell] Haskell Platform Release

2012-05-13 Thread Dominic Steinitz

Hi,

The release timetable 
http://trac.haskell.org/haskell-platform/wiki/ReleaseTimetable says 
there will be a new release of the Haskell Platform in May. Can someone 
give an update on this?


Many thanks, Dominic.

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


[Haskell-cafe] Problem Installing ad (Automatic Differentiation) Package

2012-04-21 Thread Dominic Steinitz

Hi,

I was trying to install ad (Automatic Differentiation) but got the 
following error. I guess the answer is to upgrade my ghc (perhaps 
someone could confirm) but I am using the Haskell Platform and would 
rather stick with that. I see from http://hackage.haskell.org/platform/ 
that the next release is due out in May. Will that be early May? in 
which case I may well wait a week or will it be late May? in which case 
I might bite the bullet and upgrade my ghc.


Thanks, Dominic

Building template-haskell-2.7.0.0...
[1 of 7] Compiling Language.Haskell.TH.Syntax.Internals ( 
Language/Haskell/TH/Syntax/Internals.hs, 
dist/build/Language/Haskell/TH/Syntax/Internals.o )
[2 of 7] Compiling Language.Haskell.TH.Syntax ( 
Language/Haskell/TH/Syntax.hs, dist/build/Language/Haskell/TH/Syntax.o )
[3 of 7] Compiling Language.Haskell.TH.PprLib ( 
Language/Haskell/TH/PprLib.hs, dist/build/Language/Haskell/TH/PprLib.o )


Language/Haskell/TH/PprLib.hs:55:10:
Illegal instance declaration for `Show Doc'
  (All instance types must be of the form (T t1 ... tn)
   where T is not a synonym.
   Use -XTypeSynonymInstances if you want to disable this.)
In the instance declaration for `Show Doc'
Updating documentation index /Users/Test/Library/Haskell/doc/index.html
cabal: Error: some packages failed to install:
ad-1.3.0.1 depends on template-haskell-2.7.0.0 which failed to install.
template-haskell-2.7.0.0 failed during the building phase. The exception 
was:

ExitFailure 1

The Glorious Glasgow Haskell Compilation System, version 7.0.3


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


Re: [Haskell-cafe] Installing REPA

2012-04-07 Thread Dominic Steinitz

On 07/04/2012 11:14, Ben Lippmeier wrote:

On 07/04/2012, at 9:33 AM, Chris Wong wrote:


On Sat, Apr 7, 2012 at 2:02 AM, Dominic Steinitz
idontgetoutm...@googlemail.com  wrote:

Hi,

I'm trying to install REPA but getting the following. Do I just install
base? Or is it more complicated than that?

Thanks, Dominic.

I think the easiest solution is to just use an older version of Repa.
According to Hackage, the latest one that works with base 4.3 is Repa
2.1.1.3:

$ cabal install repa==2.1.1.3

I've just pushed Repa 3 onto Hackage, which has a much better API than the 
older versions, and solves several code fusion problems. However, you'll need 
to upgrade to GHC 7.4 to use it. GHC 7.0.3 is two major releases behind the 
current version.

Ben.



Hi Ben, Chris and Others,

Thanks for your replies and suggestions. All I want to do is invert 
(well solve actually) a tridiagonal matrix so upgrading ghc from the 
version that comes with the platform seems a bit overkill. I think I 
will go with Chris' suggestion for now and maybe upgrade ghc (and REPA) 
when I am feeling braver.


Dominic.

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


[Haskell-cafe] GHCi runtime linker: fatal error (was Installing REPA)

2012-04-07 Thread Dominic Steinitz

On 07/04/2012 15:42, Dominic Steinitz wrote:

On 07/04/2012 11:14, Ben Lippmeier wrote:

On 07/04/2012, at 9:33 AM, Chris Wong wrote:


On Sat, Apr 7, 2012 at 2:02 AM, Dominic Steinitz
idontgetoutm...@googlemail.com  wrote:

Hi,

I'm trying to install REPA but getting the following. Do I just 
install

base? Or is it more complicated than that?

Thanks, Dominic.

I think the easiest solution is to just use an older version of Repa.
According to Hackage, the latest one that works with base 4.3 is Repa
2.1.1.3:

$ cabal install repa==2.1.1.3
I've just pushed Repa 3 onto Hackage, which has a much better API 
than the older versions, and solves several code fusion problems. 
However, you'll need to upgrade to GHC 7.4 to use it. GHC 7.0.3 is 
two major releases behind the current version.


Ben.



Hi Ben, Chris and Others,

Thanks for your replies and suggestions. All I want to do is invert 
(well solve actually) a tridiagonal matrix so upgrading ghc from the 
version that comes with the platform seems a bit overkill. I think I 
will go with Chris' suggestion for now and maybe upgrade ghc (and 
REPA) when I am feeling braver.


Dominic.
Sadly I now get this when trying to mulitply two matrices. Is this 
because I have two copies of Primitive? I thought Cabal was supposed to 
protect me from this sort of occurrence. Does anyone have any 
suggestions on how to solve this?


Tests-MacBook-Pro:PDE Test$ ghc-pkg list | grep -i prim
WARNING: there are broken packages.  Run 'ghc-pkg check' for more details.
ghc-prim-0.2.0.0
primitive-0.3.1
primitive-0.4.0.1

*Main mmMult xx xx
Loading package primitive-0.4.0.1 ...

GHCi runtime linker: fatal error: I found a duplicate definition for symbol
   _memcpy_off
whilst processing object file
   
/Users/Test/Library/Haskell/ghc-7.0.3/lib/primitive-0.4.0.1/lib/HSprimitive-0.4.0.1.o

This could be caused by:
   * Loading two different object files which export the same symbol
   * Specifying the same object file twice on the GHCi command line
   * An incorrect `package.conf' entry, causing some object to be
 loaded twice.
GHCi cannot safely continue in this situation.  Exiting now.  Sorry.



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


[Haskell-cafe] Installing REPA

2012-04-06 Thread Dominic Steinitz

Hi,

I'm trying to install REPA but getting the following. Do I just install 
base? Or is it more complicated than that?


Thanks, Dominic.

Tests-MacBook-Pro:PDE Test$ cabal install repa
Resolving dependencies...
cabal: cannot configure repa-2.2.0.1. It requires base ==4.4.*
For the dependency on base ==4.4.* there are these packages: 
base-4.4.0.0 and

base-4.4.1.0. However none of them are available.
base-4.4.0.0 was excluded because of the top level dependency base -any
base-4.4.1.0 was excluded because of the top level dependency base -any

Tests-MacBook-Pro:PDE Test$ cabal --version
cabal-install version 0.10.2
using version 1.10.1.0 of the Cabal library
Tests-MacBook-Pro:PDE Test$

Tests-MacBook-Pro:PDE Test$ ghc --version
The Glorious Glasgow Haskell Compilation System, version 7.0.3


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


Documentation Bug?

2011-12-14 Thread Dominic Steinitz
The link on http://www.haskell.org/ghc/docs/latest/html/users_guide/hpc.html to 
http://www.haskell.org/hpc seems to be broken.


___
Glasgow-haskell-bugs mailing list
Glasgow-haskell-bugs@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs


hp2ps Bug?

2011-08-17 Thread Dominic Steinitz
If I use profiling on windows with relative path names e.g. the first line in 
the .hp file is something like:

JOB ScriptUsage.exe -t ..\FPF\TradeDesc\TradesTags.txt -f ..\out\FPOs -
u ..\Data\LogStarted090511c +RTS -H256M -hc

then hp2ps produces nonsense.

If I replace this line with:

JOB ScriptUsage.exe +RTS -H256M -hc

then it works.

Is this a known bug or should I try to raise one?

Thanks, Dominic.


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell-cafe] Re: Codec.Crypto.RSA question

2010-11-20 Thread Dominic Steinitz
Charles-Pierre Astolfi cpa at crans.org writes:

 
 Hi -cafe,
 
 I have a question about Codec.Crypto.RSA: how to enforce that
 (informally) decrypt . encrypt = id
 Consider this code:
 
That's certainly what I would expect and one of the unit tests  that comes with
http://hackage.haskell.org/packages/archive/Crypto/4.2.2/doc/html/Codec-Encryption-RSA.html
checks for this. I wasn't able to get you code to compile so I couldn't
investigate further. Maybe you could post a fully compiling example?

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


[Haskell-cafe] Re: Haddock Problem

2010-06-24 Thread Dominic Steinitz
 Does anyone have any suggestions or do I have to start building haddock 
myself?

Ok I built it from source rather than using the Haskell Platform exe and it now 
works. Perhaps the packager of the Haskell Platform for Windows could take a 
look at why the binary is behaving as it does?

Dominic.

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


[Haskell-cafe] Re: Haddock Problem

2010-06-22 Thread Dominic Steinitz
malcolm.wallace malcolm.wallace at me.com writes:

 
 I haven't been following closely, but how did you install haddock?  From a 
binary dist?  Is it possible that
 one of the Windows binary dists has a baked-in location for something on 
the E: drive, which existed on
 the packager's machine but not on the final installed machine?

We are on the Haskell Platform 2010.1.0.0 and haddock comes as a .exe with it.

Does anyone have any suggestions or do I have to start building haddock myself?

Thanks, Dominic.

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


[Haskell-cafe] Re: Haddock Problem

2010-06-15 Thread Dominic Steinitz
David Waern david.waern at gmail.com writes:

 I think using --optghc=-package-conf is the correct way to point to
 another package DB, so I'll look into why it doesn't work.

Perhaps another line of attack would be to see why haddock thinks I have 
an E: drive?



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


[Haskell-cafe] Haddock Problem

2010-06-14 Thread Dominic Steinitz
..\ThirdParty\Haskell_Platform\2010.1.0.0\bin\haddock.exe BackendC\Core.hs

haddock.exe: can't find a package database at
E:\ghc\ghc-6.12.1lib\package.conf.d

But if I do haddock --help there is no option to set the package database and I 
don't even have an E: drive.

I'm on windows in case that wasn't obvious and we have a custom package 
database which we point e.g. ghc and cabal at.

Can someone tell me what I am doing wrong?

Many thanks, Dominic.


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


[Haskell-cafe] Re: Haddock Problem

2010-06-14 Thread Dominic Steinitz
 Try --optghc=-package-conf --optghc=file, to point Haddock at the custom 
DB.

Hi David, Thanks for the quick response. No dice I am afraid. Dominic. BTW this 
(using optghc) used to work on previous versions of haddock (iirc 2.4 and 2.5).

..\ThirdParty\Haskell_Platform\2010.1.0.0\bin\haddock.exe
--optghc=-package-conf
--optghc=c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell
_packages\fpf.package.conf
backendc\PAD2C.hs

haddock.exe: can't find a package database at E:\ghc\ghc-6.12.1
\lib\package.conf.d

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


[Haskell-cafe] Re: Haddock Problem

2010-06-14 Thread Dominic Steinitz
David Waern david.waern at gmail.com writes:

 
 2010/6/14 David Waern david.waern at gmail.com:
 
  OK, it seems like the path from the ghc-paths package overrided what
  you specified. I'm not sure this will work, but you could try:
 
   haddock -B 
c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages\fpf.pack
age.conf
 
 Sorry, that should be
 
   haddock -B 
c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages
 
 David
 
Better but no cigar.

..\ThirdParty\Haskell_Platform\2010.1.0.0\bin\haddock.exe
-B 
c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages\fpf.pack
age.conf
backendc\PAD2C.hs
haddock.exe: can't find a package database at 
C:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages\fpf.pack
age.conf\package.conf.d

And indeed I do not have a directory called package.conf.d.

So I created one and copied our custom package databse into it but still no 
luck:

..\ThirdParty\Haskell_Platform\2010.1.0.0\bin\haddock.exe -B 
c:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages 
backendc\PAD2C.hs
haddock: internal Haddock or GHC error: 
C:\p4wksp\steinitd_fpf_exdate_ws\FPF_Dev.br\ThirdParty\haskell_packages\package.
conf.d\package.cache: openBinaryFile: does not exist (No such file or directory)

I'm not what this file is. Is it the same as the index file that cabal uses?

Dominic.






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


[Haskell-cafe] Re: Linguistic hair-splitting

2010-02-15 Thread Dominic Steinitz
wren ng thornton wren at freegeek.org writes:
 or whatever).
 
 Haskell and similar languages choose a particular set of coercions to 

Nice explanation.

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


[Haskell-cafe] Re: Category Theory woes

2010-02-02 Thread Dominic Steinitz
Mark Spezzano mark.spezzano at chariot.net.au writes:

 
 Maybe there are books on Discrete maths or Algebra or Set Theory that deal
more with Hom Sets and Hom Functions?
 

Googling haskell category theory I got:

http://en.wikibooks.org/wiki/Haskell/Category_theory

http://www.haskell.org/haskellwiki/Category_theory

and many others. The latter has a list of books. Perhaps people could update
with books they are familiar with and add comments?

Dominic.

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


[Haskell-cafe] Re: (liftM join .) . mapM

2009-12-29 Thread Dominic Steinitz
Stephen Tetley stephen.tetley at gmail.com writes:

 -- | Compose an arity 1 function with an arity 2 function.
 -- B1 - blackbird
 oo :: (c - d) - (a - b - c) - a - b - d
 oo f g = (f .) . g
 
 Extending the arity works quite nicely too:
 
 -- | Compose an arity 1 function with an arity 3 function.
 -- B2 - bunting
 ooo :: (d - e) - (a - b - c - d) - a - b - c - e
 ooo f g = ((f .) .) . g

And oo = (.).(.) and ooo = (.).(.).(.)

There was a suggestion a few years back to standardise these as I recall
something like:

 $0 = $
 $1 = .
 $2 = (.).(.)

and so on but nothing came of it.

Dominic.



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


[Haskell-cafe] ForSyDe (parameterized-data) fails to build

2009-12-15 Thread Dominic Steinitz
I'm not sure how actively this is maintained or used but I couldn't get it to 
build.

Downloading parameterized-data-0.1.3...
Configuring parameterized-data-0.1.3...
Preprocessing library parameterized-data-0.1.3...
Building parameterized-data-0.1.3...

src\Data\Param\FSVec.hs:1:46:
Warning: -XPatternSignatures is deprecated: use -XScopedTypeVariables or 
pragma {-# LANGUAGE Sco
pedTypeVariables#-} instead

src\Data\Param\FSVec.hs:462:0:  warning: no newline at end of file
[1 of 2] Compiling Data.Param.FSVec ( src\Data\Param\FSVec.hs, 
dist\build\Data\Param\FSVec.o )

src\Data\Param\FSVec.hs:103:22:
Couldn't match expected type `t - ExpQ'
   against inferred type `FSVec s a1'
In the expression:
(readFSVec str) (lift :: (Nat s, Lift a) = FSVec s a - ExpQ)
In the expression:
((readFSVec str) (lift :: (Nat s, Lift a) = FSVec s a - ExpQ),
 undefined)
In the definition of `parseFSVecExp':
parseFSVecExp str
= ((readFSVec str) (lift :: (Nat s, Lift a) = FSVec s 
a - ExpQ),
   undefined)
cabal.exe: Error: some packages failed to install:
ForSyDe-3.0 depends on parameterized-data-0.1.3 which failed to install.
parameterized-data-0.1.3 failed during the building phase. The exception was:
exit: ExitFailure 1

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


[Haskell-cafe] Re: haskell-src-exts Question

2009-11-16 Thread Dominic Steinitz
Niklas Broberg niklas.broberg at gmail.com writes:
 please? http://trac.haskell.org/haskell-src-exts 

Niklas, I'd love to raise a bug for it but unfortunately I can't log on to 
trac. I don't understand why but none of my colleagues can log on either. It's 
been a long standing issue. I presume it's to do with our proxy but we can log 
on to lots of other sites. Perhaps you could cut and paste the email I sent? 
Dominic.

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


[Haskell-cafe] Re: haskell-src-exts Question

2009-11-16 Thread Dominic Steinitz
Dominic Steinitz dominic at steinitz.org writes:

 
 Niklas Broberg niklas.broberg at gmail.com writes:
  please? http://trac.haskell.org/haskell-src-exts 
 
 Niklas, I'd love to raise a bug for it but unfortunately I can't log on to 

Good news. Although I couldn't logon as guest, I've created an account and can 
logon as that. I'll create the ticket now.



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


[Haskell-cafe] haskell-src-exts Question

2009-11-13 Thread Dominic Steinitz
I've been generating Haskell using haskell-src-exts but the prettyprinter isn't 
producing what I would expect.

I would expect parse . prettyPrint == id i.e. the AST should be unchanged if 
you prettyprint it then parse it.

Here's an example generated expression:

App (App (Var (UnQual (Ident pay))) (Var (UnQual (Ident tPD (App (Var 
(UnQual (Ident a))) (InfixApp (App (Var (UnQual (Ident length))) (Var 
(UnQual (Ident tOD (QVarOp (UnQual (Symbol +))) (Lit (Int (-1)

Here's what prettyPrint produces:

pay tPD a length tOD + -1

Parsing it gives this (i.e. not the expression I first thought of):

InfixApp (App (App (App (App (Var (UnQual (Ident pay))) (Var (UnQual 
(Ident tPD (Var (UnQual (Ident a (Var (UnQual (Ident length 
(Var (UnQual (Ident tOD (QVarOp (UnQual (Symbol +))) (NegApp (Lit (Int 
1)))

I would have expected the prettyprinter to produce this:

pay tPD (a (length tOD + -1))

Do I have to write my own prettyprinter? Do I have to put in explicit 
parentheses? The latter seems unsatisfactory as my generated AST is unambiguous 
and bracketing ought to be part of the prettyprinter. The former would be quite 
a lot of code as there are many cases to consider.

Dominic.

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


Re: HPC gives spurious results if sources are compiled with -cpp

2009-07-18 Thread Dominic Steinitz
Ian Lynagh wrote:
 On Wed, Jul 15, 2009 at 04:05:14PM +, Dominic Steinitz wrote:
 Simon Marlow marlowsd at gmail.com writes:

 On 14/07/2009 10:08, Dominic Steinitz wrote:
 Trac doesn't seem to work for us so I'm sending this bug report by email.
 What's the symptom?

 Cheers,
 Simon

 I hit New Bug and get

 TICKET_CREATE privileges are required to perform this operation

 If I then hit login I get a Create New Ticket screen.

 I then fill in the details and hit submit and I get

 TICKET_CREATE privileges are required to perform this operation 

 and all my details are lost :-(
 
 I've explicitly added dominic and Dominic to group user, but I
 don't think that should be necessary.
 
 If that doesn't fix it then my guess would be that you have some sort of
 firewall or HTTP proxy that is fiddling with the cookie data.
 
 When you log in, does trac say logged in as ..., or does it still look
 like you are not logged in?
 
 
 Thanks
 Ian
 
 
 
Ian,

We are behind a proxy and a firewall so that's the most likely
explanation. I don't think I have a problem logging in to other sites
(I'm sure I would have noticed). I'm not in work now so I can't try
anything out. I know I have to set up various darcs environment
variables at work to get darcs to work (DARCS_PROXYUSERPWD is one and
there may be another).

Thanks for investigating, Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: HPC gives spurious results if sources are compiled with -cpp

2009-07-15 Thread Dominic Steinitz
Simon Marlow marlowsd at gmail.com writes:

 
 On 14/07/2009 10:08, Dominic Steinitz wrote:
  Trac doesn't seem to work for us so I'm sending this bug report by email.
 
 What's the symptom?
 
 Cheers,
   Simon
 
I hit New Bug and get

TICKET_CREATE privileges are required to perform this operation

If I then hit login I get a Create New Ticket screen.

I then fill in the details and hit submit and I get

TICKET_CREATE privileges are required to perform this operation 

and all my details are lost :-(


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users



HPC gives spurious results if sources are compiled with -cpp

2009-07-14 Thread Dominic Steinitz
Trac doesn't seem to work for us so I'm sending this bug report by email.

ghc --version
The Glorious Glasgow Haskell Compilation System, version 6.10.1

ghc.exe -fhpc -cpp --make CommonHPC.hs -o CommonHPC

commonHPC

hpc markup CommonHPC --fun-entry-count

This gives no entry counts for fact in Common.hs. With more complex modules, 
you get spurious red, yellow and green over expressions.

Dominic.

CommonHPC.hs:

module Main (main) where

import Common

main = do
  test
  test

test = do
  putStrLn $ show $ fact 4
  putStrLn $ show $ fact 5

Common.hs:

module Common (
   fact
)
where

fact 0 = 1
fact n = n * fact (n-1)



___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell-cafe] Re: Haddock : parse error on input `{-# UNPACK'

2009-06-07 Thread Dominic Steinitz
Erik de Castro Lopo mle+hs at mega-nerd.com writes:

 
 Dominic Steinitz wrote:
 
  Erik de Castro Lopo mle+hs at mega-nerd.com writes:
  
   
 src/Data/Binary/Strict/IncrementalGet.hs:106:11:
 parse error on input `{-# UNPACK'
   
  
  This is a haddock error and I presume a bug in haddock.
 
 Well I raised a bug here:
 
 http://trac.haskell.org/haddock/ticket/109
 
 Thats actually not the problem. I'm trying to build a debian package
 for this thing and this haddock problem is preventing that.
 
 Erik

This seems to be the problem:
http://hackage.haskell.org/trac/hackage/ticket/230. There's obviously a work
round for it as the haddock for the binary package builds (e.g.
http://hackage.haskell.org/packages/archive/binary/0.5.0.1/doc/html/Data-Binary-Get.html)
but I don't know what it is.

What's even more frustrating is one of the authors of has tried:

#ifndef __HADDOCK__
-- | The parse state
data S = S {-# UNPACK #-} !BL.ByteString  -- ^ input
   {-# UNPACK #-} !Int  -- ^ bytes read
   {-# UNPACK #-} ![B.ByteString]
   {-# UNPACK #-} !Int  -- ^ the failure depth
#endif

and haddock ignores this. And the binary package just has this (no ifdefs!):

-- Our internal buffer type
data Buffer = Buffer {-# UNPACK #-} !(ForeignPtr Word8)
 {-# UNPACK #-} !Int-- offset
 {-# UNPACK #-} !Int-- used bytes
 {-# UNPACK #-} !Int-- length left

Perhaps one of the authors of binary can tell us their secret of success?

Dominic.



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


[Haskell-cafe] Re: Haddock : parse error on input `{-# UNPACK'

2009-06-07 Thread Dominic Steinitz
Dominic Steinitz dominic at steinitz.org writes:

 
 Erik de Castro Lopo mle+hs at mega-nerd.com writes:
 
  
  Dominic Steinitz wrote:
  
   Erik de Castro Lopo mle+hs at mega-nerd.com writes:
   

  src/Data/Binary/Strict/IncrementalGet.hs:106:11:
  parse error on input `{-# UNPACK'

   
   This is a haddock error and I presume a bug in haddock.
  
  Well I raised a bug here:
  
  http://trac.haskell.org/haddock/ticket/109
  

Ha! It's yet another of haddock's quirks. If I replace -- ^ by -- then haddock
accepts {-#. I'll update the ticket you created.

-- | The parse state
data S = S {-# UNPACK #-} !BL.ByteString  -- ^ input
   {-# UNPACK #-} !Int  -- ^ bytes read
   {-# UNPACK #-} ![B.ByteString]
   {-# UNPACK #-} !Int  -- ^ the failure depth

-- | The parse state
data S = S {-# UNPACK #-} !BL.ByteString  -- input
   {-# UNPACK #-} !Int  -- bytes read
   {-# UNPACK #-} ![B.ByteString]
   {-# UNPACK #-} !Int  -- the failure depth

Dominic.

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


[Haskell-cafe] Re: Haddock : parse error on input `{-# UNPACK'

2009-06-06 Thread Dominic Steinitz
Erik de Castro Lopo mle+hs at mega-nerd.com writes:

 
   src/Data/Binary/Strict/IncrementalGet.hs:106:11:
   parse error on input `{-# UNPACK'
 
 Is this a bug? Is there any way to work around it?
 

This is a haddock error and I presume a bug in haddock. I don't know whether
cabal installs things if haddock fails. You could do ghc-pkg list and see what's
there. If it didn't install then you can install by hand:

1. Extract the sources and in that directory:
2. runghc Setup.lhs configure
3. runghc Setup.lhs build
4. runghc Setup.lhs install

You might want to do configure with --user - that's what cabal defaults to.

Dominic


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


Re: [Haskell-cafe] Cabal, Time GHC 6.10.2

2009-05-24 Thread Dominic Steinitz
Duncan Coutts wrote:
 On Sun, 2009-05-17 at 09:17 +0100, Dominic Steinitz wrote:
 I get

 d...@linux-6ofq:~/asn1 runghc Setup.hs configure
 Configuring PER-0.0.20...
 Setup.hs: At least the following dependencies are missing:
 time -any  -any
 but I have time

 d...@linux-6ofq:~/asn1 ghc-pkg list | grep time
 old-locale-1.0.0.1, old-time-1.0.0.2, packedstring-0.1.0.1,
 time-1.1.2.4
 I think I can see why cabal isn't finding it:

 ghc-pkg dump --global | grep time-1.1.2.4
 finds nothing and I believe that is what cabal uses to find things.
 
 The default for runghc Setup.hs configure is --global, but the default
 for cabal configure is --user. So if you're using the cabal program
 to install packages, then you can also us it to configure other
 packages. If for you need to use the runghc Setup.hs interface (e.g. in
 some system build scripts) and you want it to pick up packages from the
 user package db then use the --user flag. If you're constantly having to
 use the runghc Setup.hs interface and doing per-user installs is a pain
 then you can set the default for the cabal program to be global installs
 in the cabal config file (~/.cabal/config).
 
 I'll add this issue to the FAQ, it come up enough. If anyone else
 reading would like to eliminate this FAQ, then implementing this ticket
 is the answer:
 
 suggest use of --user if configure fails with missing deps that
 are in the user db
 http://hackage.haskell.org/trac/hackage/ticket/384
 
 Duncan
 
 
 
Duncan,

Thanks very much. I'm happy to update the FAQ this weekend unless you
have already done it.

Dominic.

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


[Haskell-cafe] HPC Website FAQ

2009-05-24 Thread Dominic Steinitz
There's a nice website for HPC but it looks a bit out of date.

http://projects.unsafeperformio.com/hpc/

I wanted to send a patch to the FAQ for using HPC with .lhs files (you
have to run ghc -E to generate .hs files and strip some of the the lines
ghc generates: {-# LINE 1 ASNTYPE.lhs #-}  #line 1 ASNTYPE.lhs).

Would it be possible for the author of HPC to make the website into a
darcs repo so that we send in patches? Apparently the Cabal website is
managed like that and it sounds like a good way of doing things in
general to me.

Thanks, Dominic.

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


[Haskell-cafe] Cabal, Time GHC 6.10.2

2009-05-17 Thread Dominic Steinitz
I get

 d...@linux-6ofq:~/asn1 runghc Setup.hs configure
 Configuring PER-0.0.20...
 Setup.hs: At least the following dependencies are missing:
 time -any  -any

but I have time

 d...@linux-6ofq:~/asn1 ghc-pkg list | grep time
 old-locale-1.0.0.1, old-time-1.0.0.2, packedstring-0.1.0.1,
 time-1.1.2.4

I think I can see why cabal isn't finding it:

 ghc-pkg dump --global | grep time-1.1.2.4

finds nothing and I believe that is what cabal uses to find things.

What's not clear is what I do to fix things. Go back to 6.10.1?

Thanks, Dominic.

 d...@linux-6ofq:~/asn1 ghc --version
 The Glorious Glasgow Haskell Compilation System, version 6.10.2
 d...@linux-6ofq:~/asn1 ghc-pkg --version
 GHC package manager version 6.10.2

Here's my .cabal file.

 Name:PER
 Version: 0.0.20
 License: BSD3
 Author:  Dominic Steinitz
 Maintainer:  dominic.stein...@blueyonder.co.uk
 Copyright:   Dominic Steinitz 2003 - 2009
 Stability:   Alpha
 Category:Language
 Homepage:http://www.haskell.org/asn1
 Synopsis:ASN.1 PER support for Haskell
 Description: A formal and executable specification of the Packed Encoding 
 Rules (PER)
  for ASN.1
 build-depends:   binary-strict == 0.4.2,
  bytestring,
  mtl,
  containers,
  time,
  pretty,
  base
 build-type:  custom
 
 Exposed-Modules: Language.ASN1.PER.Integer
  Language.ASN1.PER.GenerateC
 
 Executable:  PERTest
 Main-Is: PERTest.hs

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


[Haskell-cafe] Re: Problems with Haskell Program Coverage

2009-04-25 Thread Dominic Steinitz
Malcolm Wallace Malcolm.Wallace at cs.york.ac.uk writes:

 
 Dominic Steinitz dominic.steinitz at blueyonder.co.uk wrote:
 
  I want to use hpc to check that the ASN.1 library tests cover all the
  code.  When I run it with a set of tests that I *know* don't test
  certain things, it  reports that they have been covered i.e. there are
  not coloured in the markup  that hpc produces. I would have expected a
  lot of yellow.
 
 The record of coverage is cumulative across multiple runs.  Is it
 possible that you did not remove an old .tix file before running the
 tests?

Thanks for your reply I was beginning to worry I might be the only person trying
to use this.

I've done a bit of investigation and it seems there are at least two problems:

1. I have literate haskell files (.lhs).

2. Even if I run them through the pre-processor (ghc -E) they still don't work 
but if I manually remove these lines (which seem to get inserted by the
pre-processor)

{-# LINE 1 ASNTYPE.lhs #-}
#line 1 ASNTYPE.lhs

then it does actually work.

It looks like a bug to me. I guess I should report it on the ghc trac.

I still have a problem with another project which doesn't use literate haskell
but does require the use of -cpp and has got #ifdef's. I haven't got to the
bottom of it yet but I'm suspicious that lines starting with # cause hpc to
misbehave.

It's strange that hpc should behave like this as I would have thought it
wouldn't care about hs / lhs and # as ghc would have done some of its standard
processing before hpc got engaged.

Dominic.

hpc_index.html


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


[Haskell-cafe] Problems with Haskell Program Coverage

2009-04-22 Thread Dominic Steinitz
I want to use hpc to check that the ASN.1 library tests cover all the code. 
When I run it with a set of tests that I *know* don't test certain things, it 
reports that they have been covered i.e. there are not coloured in the markup 
that hpc produces. I would have expected a lot of yellow.

It seems to work ok on small amounts of code so I'm not clear what I'm doing 
wrong. I'd be happy to provide the .tix file or put the .html files somewhere 
if that would be helpful.

Here's what I use:

ghc -o NewTest NewTest.hs -fhpc --make

NewTest

hpc markup NewTest

Dominic.

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


[Haskell] Re: deriving Show for GADT?

2009-04-14 Thread Dominic Steinitz
Norman Ramsey nr at cs.tufts.edu writes:

 
 I've got a fairly large GADT for which I wished to use
deriving (Show)
You will have to write one by hand. I tend to use Text.Pretty and then the
output is much more readable. It doesn't take long even for a what I would
consider a large GADT.

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


[Haskell] Re: seeking papers with good examples of the use of GADTs

2009-04-13 Thread Dominic Steinitz
 I am hoping some of you may have suggestions about other papers that
 would be good tutorials in the use of GADTs.
 
 Norman
 
Norman,

This is very much in a state of flux but it may be worth taking a look at
http://code.haskell.org/asn1/ASNTYPE.lhs. There's also
http://www.haskell.org/haskellwiki/QuickCheck_/_GADT which may be of interest.

Dominic.



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


[Haskell-cafe] Re: how to link to external documentation with haddock ?

2009-01-12 Thread Dominic Steinitz
minh thu noteed at gmail.com writes:

http://www.haskell.org/haskellwiki/Haddock/FAQ

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


Re: GADT Strangeness

2009-01-10 Thread Dominic Steinitz
Simon Peyton-Jones wrote:

 | Is it worth noting it here
 | http://haskell.org/haskellwiki/Upgrading_packages#Changes_to_GADT_matching
 | or is it something that has always existed with GADTs and I just didn't
 | trip over it?
 
 I've added a para.  Good idea.

Thanks very much. I'm slightly embarassed: what I meant was that I would
add the paragraph if you thought it was worth doing.

 OK.  let's see if anyone else comments.  Do ping me in a while to action it 
 if I forget.

I suppose its priority depends on how many people start to get tripped
up. I'm guessing there aren't that many GADT users who don't know (by
now at any rate) how to understand the error messages. I'm sure there
are plenty of higher priority items.

Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell-cafe] Re: Low-level networking [Haskell not ready for Foo]

2009-01-09 Thread Dominic Steinitz
John Goerzen jgoerzen at complete.org writes:
  Any idea how I get Haskell to send ICMP ECHO packets? (And, obviously, 
  receive the replies.)
 
 SocketType claims to support Raw, which I think is the conventional
 means for doing this.  Whether all the infrastructure for that is there,
 I don't know.  I have never worked with raw sockets though, so I may be
 leading you down a dark mugger-laden alley here 

Here's an example of a Haskell version of ping, now sadly bit-rotted.

Dominic.

http://haskell.org/networktools/src/ping/test.hs

http://haskell.org/networktools/src/ping/

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


Re: GADT Strangeness

2009-01-03 Thread Dominic Steinitz
Simon Peyton-Jones wrote:
 | If I remove -XScopedTypeVariables from this http://hpaste.org/13230
 then | I get the following error message: | | 
 Asn1cTestNew.hs:55:27: |  GADT pattern match in non-rigid
 context for `INTEGER' |Solution: add a type signature | 
 In the pattern: INTEGER |  In the definition of
 `referenceTypeAndValAux2': |  referenceTypeAndValAux2 ns
 INTEGER x |= lhs ns  text  =
   text (show x)  semi |  Failed, modules loaded: Language.ASN1,
 ASNTYPE. | | At the very least the message is unhelpful. It was only
 by accident I | decided to put in -XScopedTypeVariables.
 
 This one had me puzzled for a while too! Here is what's happening.
 
 You have three mutually recursive functions: referenceTypeAndValAux1 
 referenceTypeAndValAux2 cSEQUENCE In Haskell 98, typechecking
 mutually recursive functions is done *together*, with each having a
 momomorphic type in the other RHSs.  That leads to an annoying
 problem, that of figuring out how their polymorphic type variables
 match up.  As a result, even the type variables in the type
 signature look non-rigid.
 
 The solution is to use -XRelaxedPolyRec, which compiles
 mutually-recursive definitions that each have a type signature one by
 one.  Precisely because of the above infelicity, both -XGADTs and
 -XScopedTypeVariables imply -XRelaxedPolyRec.

Thanks very much for this. I would never have guessed to use
-XRelaxedPolyRec given the error message.

Is it worth noting it here
http://haskell.org/haskellwiki/Upgrading_packages#Changes_to_GADT_matching
or is it something that has always existed with GADTs and I just didn't
trip over it?

 
 This is a nasty corner I agree.  GHC requires -XGADTs for you to
 *define* a GADT. Perhaps it should also require -XGADTs for you to
 *match against* one (as you are doing here).  That would avoid this
 particular hole.  If you think that would be a step forward, do put
 forward a Trac feature request, and encourage others to support it.

I would vote for this. In fact I was mildly surprised I could use GADTs
without specifying -XGADTs.

I noticed that Isaac Dupree has already raised a ticket
http://permalink.gmane.org/gmane.comp.lang.haskell.glasgow.user/16109 so
I will add my support to it.

Many thanks and a happy new year, Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


GADT Strangeness

2008-12-21 Thread Dominic Steinitz
If I remove -XScopedTypeVariables from this http://hpaste.org/13230 then
I get the following error message:

 Asn1cTestNew.hs:55:27:
 GADT pattern match in non-rigid context for `INTEGER'
   Solution: add a type signature
 In the pattern: INTEGER
 In the definition of `referenceTypeAndValAux2':
 referenceTypeAndValAux2 ns INTEGER x
   = lhs ns  text  =   text (show x)  
 semi
 Failed, modules loaded: Language.ASN1, ASNTYPE.

At the very least the message is unhelpful. It was only by accident I
decided to put in -XScopedTypeVariables.

Can anyone offer an explanation as to what is happening?

Dominic.


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: pbkdf2 on hackage Re: Re[2]: [Haskell-cafe] Password hashing

2008-12-07 Thread Dominic Steinitz
Thomas Hartman wrote:
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/PBKDF2
 
 Since no one took up my code review request I just did the best I

 Also I'm open to folding this into a more established crypto package
 if there are any takers... psst, dominic.

I've now had chance to review this and it looks a reasonable function to
include in the package. I'd love a patch. First a few comments:

1. Experience has taught me that you need a few tests against known test
vectors. If you look in the crypto package you will see there are
several such test programs. You could either create your own or add to
e.g. SymmetricTest (probably easiest).

 pbkdf2' :: ([Word8] - [Word8] - [Word8]) - Integer - Integer -
 Integer - Password - Salt - HashedPass

2. Any reason for the arguments being in a different order to that in
the spec?

 -- The spec says
 -- Here, INT (i) is a four-octet encoding of the integer i, most
 significant octet first.
 -- I'm reading from the right... is this the right thing?

3. I don't know but some known test vectors will almost certainly flush
this out.

 toWord8s x = L.unpack . encode $ x


4. Is there a guarantee that encode (I assume from Binary) does what is
required? I think you are guaranteed that encode . decode == id but I
don't know if any guarantee is made about the actual encoding (I haven't
checked by the way).

 --intToFourWord8s :: Integer - [Word8]
 intToFourWord8s i = let w8s =  toWord8s $ i
in drop (length w8s -4) w8s

5. This looks slightly suspicious. It won't work in general. I assume
you are sure that it is only ever used for the correctly sized Integers?

Thanks for your contribution, Dominic.

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


[Haskell-cafe] Control.Exception Funny

2008-11-29 Thread Dominic Steinitz
I'm probably doing something wrong but this example doesn't compile for
me under ghc 6.10.1
(http://www.haskell.org/ghc/docs/latest/html/libraries/base/Control-Exception.html#4):

catch (openFile f ReadMode)
(\e - hPutStr stderr (Couldn't open ++f++:  ++ show e))

 Run.hs:77:24:
 Couldn't match expected type `Handle' against inferred type `()'
   Expected type: IO Handle
   Inferred type: IO ()
 In the expression:
 hPutStr stderr (Couldn't open  ++ d ++ :  ++ show e)
 In the second argument of `CE.catch', namely
 `(\ e - hPutStr stderr (Couldn't open  ++ d ++ :  ++ show e))'

Fair enough because openFile returns a Handle and hPutStr returns () so
they don't match as the compiler says.

 CE.catch :: (CE.Exception e) = IO a - (e - IO a) - IO a

So if I fix the example thus:

 foo d = CE.catch (openFile d ReadMode  return ())
  (\e - hPutStr stderr (Couldn't open ++ d ++:  ++ show 
 e))

I get

 Run.hs:70:8:
 Ambiguous type variable `e' in the constraint:
   `CE.Exception e'
 arising from a use of `CE.catch' at Run.hs:(70,8)-(71,78)
 Probable fix: add a type signature that fixes these type variable(s)

Now I think I never used to get this under 6.8.2 but I don't easily have
a 6.8.2 to try it out on.

Doing what the compiler suggests doesn't work for obvious reasons:

 foo :: CE.Exception e = FilePath - IO ()
 foo d = CE.catch (openFile d ReadMode  return ())
  (\e - hPutStr stderr (Couldn't open ++ d ++:  ++ show 
 e))

 Run.hs:69:0:
 Ambiguous constraint `CE.Exception e'
 At least one of the forall'd type variables mentioned by the 
 constraint
 must be reachable from the type after the '='
 In the type signature for `foo':
   foo :: (CE.Exception e) = FilePath - IO ()

There seems to be a ticket for it
(http://hackage.haskell.org/trac/ghc/ticket/2819) but this doesn't give
a suggested example that compiles.

Dominic.

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


Re: [Haskell-cafe] Control.Exception Funny

2008-11-29 Thread Dominic Steinitz
Claus Reinke wrote:
 btw, if your handler cannot return the same type as your action, is this
 the right place to catch the exceptions?
 

That was an example, the real code looks something like this:

do d - getCurrentDirectory
   t - getCurrentTime
   let u = asn1c. ++ show (utctDay t) ++ . ++ show (utctDayTime t)
   createDirectory u
   setCurrentDirectory u
   CE.catch (do writeASN1AndC (genFile . asn1) (genFile . c) ty val
runCommands [(asn1c ++   ++ asn1cOptions ++   ++ 
 skeletons ++   ++ (genFile . asn1), Failure in asn1c)]
d - getCurrentDirectory
fs - getDirectoryContents d
let cFiles = 
   case os of
  mingw32 - 
 (genFile . c):(name . c):(cFiles' 
 [converter-sample.c] .c.lnk fs)
  _ -
 (genFile . c):(name . c):(cFiles' 
 [genFile . c, name . c, converter-sample . c] .c fs)
putStrLn (show cFiles)
putStrLn (show (map compile cFiles))
runCommands (map compile cFiles)
putStrLn (linker ++   ++ linkerOut genFile ++   ++ 
 (* . objectSuffix))
runCommands [
   (linker ++   ++ linkerOut genFile ++   ++ (* . 
 objectSuffix), Failure linking),
   ((executable genFile) ++   ++ (genFile . per), 
 Failure executing)
   ]
readGen (genFile . per) ty)
(\e - hPutStrLn stderr (Problem with generating / 
 compiling\n ++ show e))
   setCurrentDirectory d

Your suggestion:

 you'll see 'IOException' listed, so 'show (e::IOException)' might do
 what you want.

works perfectly.

Thanks very much, Dominic.


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


Re: GADT Type Checking GHC 6.10 versus older GHC

2008-11-28 Thread Dominic Steinitz
Ignore my last email. I was accidentally using

 The Glorious Glasgow Haskell Compilation System, version 6.9.20080616

Mind you I am still having problems just not the same ones. I'll report
back later.

Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: GADT Type Checking GHC 6.10 versus older GHC

2008-11-28 Thread Dominic Steinitz
Simon Peyton-Jones wrote:
 |  I also feel that the type errors given when working with existential
 |  types, especially GADTs with existentials, are confusing.  I think
 |
 | I am using existential types to test GADT code. See
 | http://www.haskell.org/haskellwiki/QuickCheck_/_GADT which no longer
 | works with 6.10.1.
 
 Really?  I've just compiled that entire page with 6.10.1, and it was fine, 
 except that I had to add a type signature for prettyRep.  No problems there.
 
 Simon
 
 
Sorry I inadvertently used an old copy of ghc.

Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: GADT Type Checking GHC 6.10 versus older GHC

2008-11-28 Thread Dominic Steinitz
Simon Peyton-Jones wrote:
 |  arbitrarySeq :: Sequence a - Gen RepSeqVal
 |  arbitrarySeq Nil =
 | return (RepSeqVal Nil Empty)
 |  arbitrarySeq (Cons (CTMandatory (NamedType n i t)) ts) =
 | do u - arbitraryType t
 |us - arbitrarySeq ts
 |case u of
 |   RepTypeVal a v -
 |  case us of
 | RepSeqVal bs vs -
 |return (RepSeqVal (Cons (CTMandatory (NamedType n i a)) 
 bs) (v:*:vs))
 |
 |
 |  QuickTest.lhs:240:13:
 |  GADT pattern match in non-rigid context for `Nil'
 |Solution: add a type signature
 |  In the pattern: Nil
 |  In the definition of `arbitrarySeq':
 |  arbitrarySeq Nil = return (RepSeqVal Nil Empty)
 
 That looks odd to me.  But it's hard to help without having the code. If you 
 send it I'll try to help.
 
 |  Did you try giving a type signature to the (entire) case expression,
 |  as I suggested?  That should do it.
 | 
 |
 | I'm not sure what this means or how to do it. Can you give an example or
 | is it buried in some earlier email? I will go and have another look.
 
 I mean replace
 (case blah of { ... })
 by
 (case blah of { ... }) :: type-sig
 
 That is, attach a type signature to the case expression itself.  Does that 
 help at least explain what the sentence means? If so would you like to 
 clarify the wiki advice?
 
 Thanks
 
 Simon
 
 
Simon,

I'm sorry to have put you to so much trouble by accidentally using an
old version of ghc I must have had lying around. As penance, I will go
and update the wiki with what I have learnt.

Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: pbkdf2 on hackage Re: Re[2]: [Haskell-cafe] Password hashing

2008-11-28 Thread Dominic Steinitz
Thomas Hartman wrote:
 http://hackage.haskell.org/cgi-bin/hackage-scripts/package/PBKDF2
 
 Since no one took up my code review request I just did the best I
 could and uploaded to hackage. There were indeed some mistakes in my
 initial post, fixed now. (Code review is still wished, though!)
 
 Alas, documentation doesn't build with hackage, altough it does for me
 locally. (Seems like almost everything I do these days -- what am I
 doing wrong?!)
 
 Also I'm open to folding this into a more established crypto package
 if there are any takers... psst, dominic.

I'd be happy to do so. In fact, I have another contribution which I need
to work on so maybe now is a good time to roll my sleeves up.

I haven't been following the thread on this. Could you give me some
references? I assume it's a perfectly good cryptographic function, then
it would be very helpful for me if you created a patch against the
crypto repository.

 
 Also, dominic, shouldn't your crypto package be added to category
 Cryptography (a cabal file change) so it lists aside the other crypto
 packages?

Yes good point - something else that needs doing. I've created the first
ticket in the trac http://trac.haskell.org/crypto/ticket/1

 If there are any crypto gurus who can code-review this I would be much
 obliged, and when I'm confident enough that this does the right thing
 I'll put it up on hackage.

 I don't do much crypto so this *definitely* needs a review before it
 becomes a library?

It depends what you are going to use it for. I've put a big disclaimer
on the crypto library because there are all sorts of attacks I've not
checked it's proof against (e.g. who knows how long keys are kept in
memory by a runtime system). You'd probably have to put in quite a lot
of work researching how e.g. this is done in other implementations and
seeing how the equivalent protection could be implemented in Haskell.


 2008/11/26 John Meacham [EMAIL PROTECTED]:
 What you are using there is not a salt, but rather a secret key. The
 important thing about a salt is that it is different for _every user_.
 and you actually store the salt unhashed along with the hash. (it is not
 secret information). A salt protects against a dictionary attack, for
 instance, you might have a dictionary of hash's and the common passwords
 they go to but if you add a 32 bit salt, you would need 2^32 entries for
 each dictionary word, making such an attack unworkable. You can also
 trivially tell if two users have the _same_ password just by comparing
 the hashes without a salt.


John is right but it still doesn't stop you publishing your function
which someone can then use as John describes.

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


GADT Type Checking GHC 6.10 versus older GHC

2008-11-27 Thread Dominic Steinitz
 In my case, we had rigid type signatures all over the place.  The
 wiki document says that the type must be rigid at the point of the
 match.  I guess that's what we were violating.  If the code I posted
 isn't supposed to type check then I would like to report, as user
 feedback, that GADTs have become unwieldy.

I'm now running into this problem big time on my existing test harness
(I'd previously checked the main code and that worked - see
http://www.haskell.org/pipermail/glasgow-haskell-users/2008-November/016160.html).

 
 I grant that it's less convenient than one would like.  The
 difficulty is that GADTs get you into territory where it's easy to
 write programs that  have multiple *incomparable* types.   That is,
 there is no best type (unlike Hindley-Milner).  So we pretty much
 have to ask the programmer to express the type.
 
 Once we are in that territory, we need to give simple rules that say
 when a type signature is needed.   I know that I have not yet found a
 way to express these rules -- perhaps GHC's users can help.  My
 initial shot is
 http://haskell.org/haskellwiki/Upgrading_packages%23Changes_to_GADT_matching#Changes_to_GADT_matching
 
 I couldn't figure out how to fix that code by just adding a type
 signature.

I've read this and I couldn't figure it out either. I've tried the
heuristic and it works fine for some cases but not others:

 arbitrarySeq :: Sequence a - Gen RepSeqVal
 arbitrarySeq Nil =
return (RepSeqVal Nil Empty)
 arbitrarySeq (Cons (CTMandatory (NamedType n i t)) ts) =
do u - arbitraryType t
   us - arbitrarySeq ts
   case u of
  RepTypeVal a v -
 case us of
RepSeqVal bs vs -
   return (RepSeqVal (Cons (CTMandatory (NamedType n i a)) bs) 
 (v:*:vs))


 QuickTest.lhs:240:13:
 GADT pattern match in non-rigid context for `Nil'
   Solution: add a type signature
 In the pattern: Nil
 In the definition of `arbitrarySeq':
 arbitrarySeq Nil = return (RepSeqVal Nil Empty)

 *Rename :t Nil
 Nil :: Sequence Nil

So this fixes the first case:

 arbitrarySeq :: Sequence a - Gen RepSeqVal
 arbitrarySeq (Nil :: Sequence Nil) =
return (RepSeqVal Nil Empty)

But not the second case:

 QuickTest.lhs:242:14:
 GADT pattern match in non-rigid context for `Cons'
   Solution: add a type signature
 In the pattern: Cons (CTMandatory (NamedType n i t)) ts
 In the definition of `arbitrarySeq':
 arbitrarySeq (Cons (CTMandatory (NamedType n i t)) ts)
= do u - arbitraryType t
 us - arbitrarySeq ts
 case u of RepTypeVal a v - ...

And now I'm stuck:

 *Rename :t Cons
 Cons :: ComponentType a - Sequence l - Sequence (a :*: l)

What type should I give the Cons pattern? If I try the heuristic:

 arbitrarySeq ((Cons (CTMandatory (NamedType n i t)) ts) :: Int) =

the the compiler suggests

 QuickTest.lhs:242:14:
 Couldn't match expected type `Sequence a'
against inferred type `Int'

but trying

 arbitrarySeq ((Cons (CTMandatory (NamedType n i t)) ts) :: Sequence a) =

gives

 QuickTest.lhs:242:68: Not in scope: type variable `a'


 
 Did you try giving a type signature to the (entire) case expression,
 as I suggested?  That should do it.
 

I'm not sure what this means or how to do it. Can you give an example or
is it buried in some earlier email? I will go and have another look.

 I urge you to consider designing a modified or new syntactic form for
 working with GADT pattern matches.  The quasi-dependent typing that
 GADTs give developers is very powerful and it would seem that GHC
 Haskell with GADTs is as close to dependent typing that developers
 writing real-world software can get.  I know of no other production
 ready compilers that provide dependent or close to dependent typing.
 Dependent typing seems to be a growing area of interest.  For these
 reasons I think it's important for GHC to focus on making them
 pleasanter to work with again; even if it means adding to the
 language again.
 
 If I knew how to do that, I'd love to.  Here's one idea you might not
 like: restrict GADT matching to function definitions only (not case
 expressions), and require a type signature for such pattern matches.
 That wouldn't require adding new stuff.  But GHC's current story is a
 bit more flexible.
 
 I also feel that the type errors given when working with existential
 types, especially GADTs with existentials, are confusing.  I think

I am using existential types to test GADT code. See
http://www.haskell.org/haskellwiki/QuickCheck_/_GADT which no longer
works with 6.10.1.

 mostly because the types of the sub-expressions in the program are
 not visible to the user.  More introspection into the inferred types
 would help users.  I have some ideas on how to improve this, what the
 output should look like and I would like to implement it too, but I
 haven't had a chance to start a prototype yet.

[Haskell-cafe] Need machine for DPH benchmarking

2008-11-27 Thread Dominic Steinitz
 we, the DPH team, are at the moment in the very unfortunate situation  
 of not having a proper machine for running our benchmarks on. Could a  
 kind soul maybe give us (i.e., me) access to a quadcore or 2xquadcore  
 x86 Linux or OS X machine? I only need to build ghc on it and run  
 small benchmarks which never take more than a couple of minutes, maybe  
 once every couple of days or so. We do need to use all cores, though,  
 so no other CPU-intensive processes can be running during  
 benchmarking. This is only for a week or two, until we get our own  
 machine. We would be eternally grateful and won't forget you when DPH  
 takes over the world.
 
 Roman
 

Roman,

Graeme can set you up on an 8 core machine if you email him.

Dominic.

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


[Haskell-cafe] Building QuickCheck 2 Under GHC 6.10.1

2008-11-27 Thread Dominic Steinitz
Having been a happy user of QuickCheck 2 for many years, I now find it 
won't build under ghc 6.10.1. Before I investigate further, has anyone 
encountered this problem and has a fix?


Thanks, Dominic.


C:\Users\Dom\QuickCheckSetup build
Preprocessing library QuickCheck-2.0...
Building QuickCheck-2.0...
[2 of 9] Compiling Test.QuickCheck.Exception ( Test\QuickCheck\Exception.hs, dis
t\build\Test\QuickCheck\Exception.o )

Test\QuickCheck\Exception.hs:12:31:
Class `Exception' used as a type
In the type `Exception'
In the type `Either Exception a'
In the type `IO (Either Exception a)'

Test\QuickCheck\Exception.hs:15:36:
Class `Exception' used as a type
In the type `Exception'
In the type `Either Exception a'
In the type `IO (Either Exception a)'




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


Re: GADT Type Checking GHC 6.10 versus older GHC

2008-11-22 Thread Dominic Steinitz
Jason Dagit dagit at codersbase.com writes:

 
 
 On Fri, Nov 21, 2008 at 8:57 AM, Simon Peyton-Jones simonpj at
microsoft.com wrote:
 You need a type signature for the case expression.  As Daniel says, this is
worth a
readhttp://haskell.org/haskellwiki/Upgrading_packages%23Changes_to_GADT_matching#Changes_to_GADT_matching
 
 
 Thanks Simon.  I had read that several times in the past and I've pointed it
out to others.  It's still relevant but, my question was about whether or not
examples like the one posted are really in error or if GHC is just being overly
strict now.
 
 In my case, we had rigid type signatures all over the place.  The wiki
document says that the type must be rigid at the point of the match.  I guess
that's what we were violating.  If the code I posted isn't supposed to type
check then I would like to report, as user feedback, that GADTs have become
unwieldy.

This is really worrying. I have spent some considerable time using GADTs to
structure a library. I haven't tried 6.10 yet because it's not available in a
packaged form for my flavour of linux. I will put some work into doing this
today and report back.

Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: GADT Type Checking GHC 6.10 versus older GHC

2008-11-22 Thread Dominic Steinitz
Dominic Steinitz dominic.steinitz at blueyonder.co.uk writes:


 packaged form for my flavour of linux. I will put some work into doing this
 today and report back.
 
 Dominic.
 

Phew - I installed the windows 6.10.1 package and everything to do with GADTs
still seems to work.

Dominic.


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


Re: 6.10.1 Bug?

2008-11-18 Thread Dominic Steinitz
Dominic Steinitz wrote:
 According to the hackage page, the Haskell Cryptography Library has a
 build failure. I couldn't find a bug reference when I searched for
 milestone 6.10.1 on trac. Should I report it? Has it been fixed?
 
 Thanks, Dominic.
 
 http://hackage.haskell.org/packages/archive/Crypto/4.1.0/logs/failure/ghc-6.10
 
 [4 of 4] Compiling Main ( SHA1Test.hs, 
 dist/build/SHA1Test/SHA1Test-tmp/Main.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 6.10.1 for i386-unknown-linux):
  RegAllocLinear.getStackSlotFor: out of stack slots, try -fregs-graph

 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug
 
 

I found it. It was filed under milestone 6.10.2 (clearly I don't
understand milestones).

http://hackage.haskell.org/trac/ghc/ticket/2753

It seems a bit vague on what's happening. Is it going to be fixed? Has
it been fixed?

Thanks, Dominic.

___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


6.10.1 Bug?

2008-11-17 Thread Dominic Steinitz
According to the hackage page, the Haskell Cryptography Library has a
build failure. I couldn't find a bug reference when I searched for
milestone 6.10.1 on trac. Should I report it? Has it been fixed?

Thanks, Dominic.

http://hackage.haskell.org/packages/archive/Crypto/4.1.0/logs/failure/ghc-6.10

 [4 of 4] Compiling Main ( SHA1Test.hs, 
 dist/build/SHA1Test/SHA1Test-tmp/Main.o )
 ghc: panic! (the 'impossible' happened)
   (GHC version 6.10.1 for i386-unknown-linux):
   RegAllocLinear.getStackSlotFor: out of stack slots, try -fregs-graph
 
 Please report this as a GHC bug:  http://www.haskell.org/ghc/reportabug


___
Glasgow-haskell-users mailing list
Glasgow-haskell-users@haskell.org
http://www.haskell.org/mailman/listinfo/glasgow-haskell-users


[Haskell-cafe] Exporting a Type Class for Type Signatures

2008-11-10 Thread Dominic Steinitz
In the crypto package, I have two functions

 encrypt :: AESKey a = a - Word128 - Word128
 decrypt :: AESKey a = a - Word128 - Word128

which are exported.

I also have

 class (Bits a, Integral a) = AESKey a
 
 instance AESKey Word128
 instance AESKey Word192
 instance AESKey Word256

unexported which stops you using invalid keys.

Someone has asked me to export AESKey as they want to write an explicit
type signature for a function they are creating e.g.

foo :: AESKey a = a - Word128 - Word128
foo x y = encrypt x y

but this generates an error. Is there a way of allowing someone to use
AESKey in a type signature but not allow them to declare new instances?

Thanks, Dominic.

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


[Haskell-cafe] Re: Problems with strictness analysis?

2008-11-04 Thread Dominic Steinitz
wren ng thornton wren at freegeek.org writes:

[snick]

  isum 0 s = s
  isum n s = isum (n-1) (s+n)
 
 This is tail recursive, and will be optimized to an iterative loop; 

[snick]

 
 In terms of having a compiler 'smart enough', it's not clear that 
 functions of this sort ought to be inferred strict simply because the 
 accumulator is ultimately returned to the caller. Consider for example:

I thought this was strict as Luke Palmer has already pointed out. My 
understanding is that a compiler may be able to infer it is strict and then 
perform eager evaluation.

 
f 0 xs = xs
f n xs = f (n-1) (replicate n n ++ xs)
 
 Since (++) can indeed return partial answers, it's fine for the 
 accumulator to be lazy. Indeed, making it strict harms performance 
 significantly. Another example is when the accumulator is a function, as 

Can this function be strict if (++)isn't? And if it isn't strict, why would it 
make sense to evaluate it eagerly?

Dominic.

PS This subject seems to come up often enough to be worth a wiki entry (maybe 
there already is one). I think we should also be careful with terminology (as 
Luke Palmer and David Menendez have pointed out. Maybe that could be included 
in the wiki entry.

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


  1   2   3   >