[GHC] #5000: Eliminate absent arguments in non-strict positions

2011-03-07 Thread GHC
#5000: Eliminate absent arguments in non-strict positions
-+--
Reporter:  batterseapower|   Owner: 
Type:  feature request   |  Status:  new
Priority:  normal|   Component:  Compiler   
 Version:  7.0.2 |Keywords: 
Testcase:|   Blockedby: 
  Os:  Unknown/Multiple  |Blocking: 
Architecture:  Unknown/Multiple  | Failure:  Runtime performance bug
-+--
 One of my programs has this is the output of GHC -O2:

 {{{
 Rec {
 h28_s14N
   :: forall t_aMK t_aML.
  Main.Nat - t_aMK - t_aML - Main.Nat - Main.Nat
 [LclId,
  Arity=4,
  Unf=Unf{Src=vanilla, TopLvl=True, Arity=4, Value=True,
  ConLike=True, Cheap=True, Expandable=True,
  Guidance=IF_ARGS [0 0 0 0] 6 2}]
 h28_s14N =
   \ (@ t_aMK)
 (@ t_aML)
 (az94z94z941_u439_amh :: Main.Nat)
 (awS1_u462_ami :: t_aMK)
 (awS1_u466_amj :: t_aML)
 (x_u590_amk :: Main.Nat) -
 Main.S
   (h29_s14O
  @ t_aMK
  @ t_aML
  az94z94z941_u439_amh
  awS1_u462_ami
  awS1_u466_amj
  x_u590_amk)

 h29_s14O [Occ=LoopBreaker]
   :: forall t_aMK t_aML.
  Main.Nat - t_aMK - t_aML - Main.Nat - Main.Nat
 [LclId,
  Arity=4,
  Unf=Unf{Src=vanilla, TopLvl=True, Arity=4, Value=True,
  ConLike=True, Cheap=True, Expandable=True,
  Guidance=IF_ARGS [0 0 0 5] 9 0}]
 h29_s14O =
   \ (@ t_aMK)
 (@ t_aML)
 (az94z94z941_u439_amm :: Main.Nat)
 (awS1_u462_amn :: t_aMK)
 (awS1_u466_amo :: t_aML)
 (x_u590_amp :: Main.Nat) -
 case x_u590_amp of _ {
   Main.Z - h21'_al8 @ Main.Nat az94z94z941_u439_amm;
   Main.S x_u595_amq -
 h28_s14N
   @ t_aMK
   @ t_aML
   az94z94z941_u439_amm
   awS1_u462_amn
   awS1_u466_amo
   x_u595_amq
 }
 end Rec }
 }}}

 This is ridiculous because the two awS1 arguments are totally dead. This
 greatly increases allocations made by the program.

 I speculate that this occurs because the recursive call to h29 is guarded
 by a use of the S constructor, making it non-strict.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5000
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #5000: Eliminate absent arguments in non-strict positions

2011-03-07 Thread GHC
#5000: Eliminate absent arguments in non-strict positions
-+--
Reporter:  batterseapower|   Owner: 
Type:  feature request   |  Status:  new
Priority:  normal|   Component:  Compiler   
 Version:  7.0.2 |Keywords: 
Testcase:|   Blockedby: 
  Os:  Unknown/Multiple  |Blocking: 
Architecture:  Unknown/Multiple  | Failure:  Runtime performance bug
-+--
Description changed by batterseapower:

Old description:

 One of my programs has this is the output of GHC -O2:

 {{{
 Rec {
 h28_s14N
   :: forall t_aMK t_aML.
  Main.Nat - t_aMK - t_aML - Main.Nat - Main.Nat
 [LclId,
  Arity=4,
  Unf=Unf{Src=vanilla, TopLvl=True, Arity=4, Value=True,
  ConLike=True, Cheap=True, Expandable=True,
  Guidance=IF_ARGS [0 0 0 0] 6 2}]
 h28_s14N =
   \ (@ t_aMK)
 (@ t_aML)
 (az94z94z941_u439_amh :: Main.Nat)
 (awS1_u462_ami :: t_aMK)
 (awS1_u466_amj :: t_aML)
 (x_u590_amk :: Main.Nat) -
 Main.S
   (h29_s14O
  @ t_aMK
  @ t_aML
  az94z94z941_u439_amh
  awS1_u462_ami
  awS1_u466_amj
  x_u590_amk)

 h29_s14O [Occ=LoopBreaker]
   :: forall t_aMK t_aML.
  Main.Nat - t_aMK - t_aML - Main.Nat - Main.Nat
 [LclId,
  Arity=4,
  Unf=Unf{Src=vanilla, TopLvl=True, Arity=4, Value=True,
  ConLike=True, Cheap=True, Expandable=True,
  Guidance=IF_ARGS [0 0 0 5] 9 0}]
 h29_s14O =
   \ (@ t_aMK)
 (@ t_aML)
 (az94z94z941_u439_amm :: Main.Nat)
 (awS1_u462_amn :: t_aMK)
 (awS1_u466_amo :: t_aML)
 (x_u590_amp :: Main.Nat) -
 case x_u590_amp of _ {
   Main.Z - h21'_al8 @ Main.Nat az94z94z941_u439_amm;
   Main.S x_u595_amq -
 h28_s14N
   @ t_aMK
   @ t_aML
   az94z94z941_u439_amm
   awS1_u462_amn
   awS1_u466_amo
   x_u595_amq
 }
 end Rec }
 }}}

 This is ridiculous because the two awS1 arguments are totally dead. This
 greatly increases allocations made by the program.

 I speculate that this occurs because the recursive call to h29 is guarded
 by a use of the S constructor, making it non-strict.

New description:

 One of my programs has this is the output of the post-worker/wrapper
 simplification:

 {{{
 Rec {
 h28_s14N
   :: forall t_aMK t_aML.
  Main.Nat - t_aMK - t_aML - Main.Nat - Main.Nat
 [LclId,
  Arity=4,
  Str=DmdType ,
  Unf=Unf{Src=vanilla, TopLvl=True, Arity=4, Value=True,
  ConLike=True, Cheap=True, Expandable=True,
  Guidance=IF_ARGS [0 0 0 0] 6 2}]
 h28_s14N =
   \ (@ t_aMK)
 (@ t_aML)
 (az94z94z941_u439_amh :: Main.Nat)
 (awS1_u462_ami :: t_aMK)
 (awS1_u466_amj :: t_aML)
 (x_u590_amk :: Main.Nat) -
 Main.S
   (h29_s14O
  @ t_aMK
  @ t_aML
  az94z94z941_u439_amh
  awS1_u462_ami
  awS1_u466_amj
  x_u590_amk)

 h29_s14O [Occ=LoopBreaker]
   :: forall t_aMK t_aML.
  Main.Nat - t_aMK - t_aML - Main.Nat - Main.Nat
 [LclId,
  Arity=4,
  Str=DmdType LLLS,
  Unf=Unf{Src=vanilla, TopLvl=True, Arity=4, Value=True,
  ConLike=True, Cheap=True, Expandable=True,
  Guidance=IF_ARGS [0 0 0 3] 7 0}]
 h29_s14O =
   \ (@ t_aMK)
 (@ t_aML)
 (az94z94z941_u439_amm :: Main.Nat)
 (awS1_u462_amn :: t_aMK)
 (awS1_u466_amo :: t_aML)
 (x_u590_amp :: Main.Nat) -
 case x_u590_amp of _ {
   Main.Z - az94z94z941_u439_amm;
   Main.S x_u595_amq [Dmd=Just L] -
 h28_s14N
   @ t_aMK
   @ t_aML
   az94z94z941_u439_amm
   awS1_u462_amn
   awS1_u466_amo
   x_u595_amq
 }
 end Rec }
 }}}

 This is ridiculous because the two awS1 arguments are totally dead. This
 greatly increases allocations made by the program.

 These absent arguments should be removed by the strictness analyser,
 However I speculate that this occurs because the recursive call to h29 is
 guarded by a use of the S constructor, making it non-strict.

--

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5000#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #5000: Eliminate absent arguments in non-strict positions

2011-03-07 Thread GHC
#5000: Eliminate absent arguments in non-strict positions
-+--
 Reporter:  batterseapower   |  Owner:  
 Type:  feature request  | Status:  closed  
 Priority:  normal   |  Component:  Compiler
  Version:  7.0.2| Resolution:  worksforme  
 Keywords:   |   Testcase:  
Blockedby:   | Os:  Unknown/Multiple
 Blocking:   |   Architecture:  Unknown/Multiple
  Failure:  Runtime performance bug  |  
-+--
Changes (by batterseapower):

  * status:  new = closed
  * resolution:  = worksforme


Comment:

 Urk, never mind: this was fixed sometime between 7.0.1.20101215 and HEAD

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5000#comment:2
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #4999: build fails on powerpc: error: 'ObjectCode' has no member named 'misalignment'

2011-03-07 Thread GHC
#4999: build fails on powerpc:   error: 'ObjectCode' has no member named
'misalignment'
+---
Reporter:  nomeata  |   Owner: 
Type:  bug  |  Status:  new
Priority:  normal   |   Component:  Runtime System 
 Version:  7.0.2|Keywords: 
Testcase:   |   Blockedby: 
  Os:  Linux|Blocking: 
Architecture:  powerpc  | Failure:  Building GHC failed
+---

Comment(by erikd):

 I have a patch that works (very thoroughly tested) against 7.0.2 which
 I'll add as an attachment.

 I've tried to apply the same patch against GHC HEAD and I've run into this
 problem:

 {{{
 rts/Linker.c:1073:7:
  error: 'alloc_blocks_lim' undeclared here (not in a function)

 rts/Linker.c:1073:7:  warning: missing initializer

 rts/Linker.c:1073:7:
  warning: (near initialization for 'rtsSyms[377].addr')
 }}}

 which seems completely unrelated to what I did and has me completely
 baffled.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4999#comment:4
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #1408: groupWhen – a groupBy that compares consecutive values

2011-03-07 Thread GHC
#1408: groupWhen – a groupBy that compares consecutive values
--+-
  Reporter:  Joachim Breitner mail@…|  Owner: 
 
  Type:  feature request  | Status:  
closed  
  Priority:  normal   |  Milestone: 
 
 Component:  libraries/base   |Version:  
6.6.1   
Resolution:  wontfix  |   Keywords: 
 
  Testcase:   |  Blockedby: 
 
Difficulty:  Easy (less than 1 hour)  | Os:  
Unknown/Multiple
  Blocking:   |   Architecture:  
Unknown/Multiple
   Failure:  None/Unknown |  
--+-
Changes (by Lemming):

 * cc: ghc@… (added)
  * failure:  = None/Unknown


Comment:

 You may like to use my groupBy in:
 http://hackage.haskell.org/packages/archive/utility-ht/0.0.5.1/doc/html
 /Data-List-HT.html#v:groupBy

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1408#comment:8
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #1408: groupWhen – a groupBy that compares consecutive values

2011-03-07 Thread GHC
#1408: groupWhen – a groupBy that compares consecutive values
--+-
  Reporter:  Joachim Breitner mail@…|  Owner: 
 
  Type:  feature request  | Status:  
closed  
  Priority:  normal   |  Milestone: 
 
 Component:  libraries/base   |Version:  
7.0.2   
Resolution:  wontfix  |   Keywords: 
 
  Testcase:   |  Blockedby: 
 
Difficulty:  Easy (less than 1 hour)  | Os:  
Unknown/Multiple
  Blocking:   |   Architecture:  
Unknown/Multiple
   Failure:  None/Unknown |  
--+-
Changes (by Lemming):

  * version:  6.6.1 = 7.0.2


Comment:

 It seems to worry many people:

 http://www.haskell.org/pipermail/haskell-cafe/2011-March/089832.html
 http://www.haskell.org/pipermail/libraries/2007-August/008039.html
 http://www.haskell.org/pipermail/haskell-cafe/2007-April/024971.html
 
http://www.haskell.org/haskellwiki/List_function_suggestions#Generalize_groupBy_and_friends

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1408#comment:9
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


[GHC] #5001: makeCorePair: arity missing

2011-03-07 Thread GHC
#5001: makeCorePair: arity missing
-+--
Reporter:  maeder|   Owner: 
  
Type:  bug   |  Status:  new
  
Priority:  normal|   Component:  Compiler   
  
 Version:  7.0.2 |Keywords: 
  
Testcase:|   Blockedby: 
  
  Os:  Unknown/Multiple  |Blocking: 
  
Architecture:  Unknown/Multiple  | Failure:  Incorrect warning at 
compile-time
-+--
 when compiling our hets sources with optimization I get unexpected
 messages like:

 {{{
 makeCorePair: arity missing $cmap_sentence{v au5bz} [lid]
 makeCorePair: arity missing $cmap_symbol{v au5bC} [lid]
 }}}

 I think it is emitted by the desugarer i.e. for the source file
 http://trac.informatik.uni-
 bremen.de:8080/hets/browser/trunk/Comorphisms/OWL2CommonLogic.hs

 I've noticed no consequences (bugs), though. Maybe it should only be
 emitted when a certain verbosity level is set.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5001
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


[GHC] #5002: 7.0.2 ignores a context which 7.0.1 picks up

2011-03-07 Thread GHC
#5002: 7.0.2 ignores a context which 7.0.1 picks up
+---
Reporter:  patrick_premont  |   Owner:   
Type:  bug  |  Status:  new  
Priority:  normal   |   Component:  Compiler 
 Version:  7.0.2|Keywords:   
Testcase:   |   Blockedby:   
  Os:  Windows  |Blocking:   
Architecture:  x86  | Failure:  GHC rejects valid program
+---
 GHC 7.0.2 rejects programs which 7.0.1 accepts.

 A passed context is not used, and the compiler (expectedly) fails to
 deduce an instance.  Patching the code so that it works again is not
 difficult. Some type annotations can do the trick. So this is not a
 critical issue but it is a bit surprising.

 I have simplified my code as much as possible so that it still shows
 the error in 7.0.2 (okIn701). I have included two further
 simplifications which produce no error : okInBoth and okInBoth'. I see
 why okInBoth is more simple (it side steps a type function), but I do
 not see why okInBoth' would avoid the problem.

 The code also compiles if we remove the instance
 declaration for class B. In that case the type of a in okIn701 can be
 infered, and the context for that type is provided.

 I have seen the following comment by dimitris in ticket #4981, which
 seems related.  I know why GHC is not picking the given up: it has to
 do with the fact that we have not saturated all possible equalities
 before we look for instances, but luckily this is something Simon and
 I are planning to fix pretty soon. Ticket #4981 seems to be an issue
 with 7.0.1. Here we see an apparent regression with 7.0.2, so I
 thought I would bring it up in case it is an unexpected change in
 behavior.

 The diagnosis of ticket #3018 may be applicable to the code here: we
 may be asking too much of the compiler. As an additional
 simplification attempt, I have added function fromTicket3018, but it
 compiles fine with 7.0.1 and 7.0.2.

 Also if the instance for 'B' is restricted to '[a]' (we can then
 remove the UndecidableInstances extension), and the type 'a' is
 replaced by '[a]' in 'okIn701', then it compiles fine. Are instances
 that match everything applied more eagerly ? If so then this
 compilatin problem should be quite rare.

 {{{

  {-# LANGUAGE TypeFamilies, FlexibleInstances, UndecidableInstances,
 FlexibleContexts #-}

  class A a
  class B a where b :: a - ()
  instance A a = B [a] where b = undefined

  newtype Y a = Y (a - ())

  okIn701 :: B [a] = Y [a]
  okIn701 = wrap $ const () . b

  okInBoth' :: B a = Y a
  okInBoth' = wrap $ b

  okInBoth :: B a = Y a
  okInBoth = Y $ const () . b

  class Wrapper a where
  type Wrapped a
  wrap :: Wrapped a - a
  instance Wrapper (Y a) where
type Wrapped (Y a) = a - ()
wrap = Y

  fromTicket3018 :: Eq [a] = a - ()
  fromTicket3018 x = let {g :: Int - Int; g = [x]==[x] `seq` id} in ()

  main = undefined

 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5002
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #4970: time002 and time004 (ghci) test failures on OS X 64 bit

2011-03-07 Thread GHC
#4970: time002 and time004 (ghci) test failures on OS X 64 bit
--+-
  Reporter:  gwright  |  Owner:  igloo 
  Type:  bug  | Status:  new   
  Priority:  high |  Milestone:  7.2.1 
 Component:  GHCi |Version:  7.0.1 
Resolution:   |   Keywords:
  Testcase:   |  Blockedby:
Difficulty:   | Os:  MacOS X   
  Blocking:   |   Architecture:  x86_64 (amd64)
   Failure:  Incorrect result at runtime  |  
--+-

Comment(by gwright):

 Replying to [comment:9 igloo]:
  It looks like the right thing to do is to define a Haskell type for the
 C `suseconds_t`, and use that. At least,
 http://pubs.opengroup.org/onlinepubs/009695399/basedefs/sys/time.h.html
 and my Linux `gettimeofday(2)` agree on that.

 That should work on OS X as well, since `__darwin_suseconds_t` is a
 typedef for `suseconds_t` (defined in `/usr/include/sys/types.h`);
 `__darwin_suseconds_t` is the type of the `tv_usec` field in `struct
 timeval`.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4970#comment:11
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


[GHC] #5003: test 4038 (ghci) fails on OS X 64 bit.

2011-03-07 Thread GHC
#5003: test 4038 (ghci) fails on OS X 64 bit.
---+
Reporter:  gwright |   Owner:   
Type:  bug |  Status:  new  
Priority:  normal  |   Component:  GHCi 
 Version:  7.0.2   |Keywords:   
Testcase:  |   Blockedby:   
  Os:  MacOS X |Blocking:   
Architecture:  x86_64 (amd64)  | Failure:  Runtime crash
---+
 Test 4038 (ghci) sometimes fails on OS X 64 bit.  When the failure
 happens, the test crashes with a segfault or bus error:
 {{{
 gwright-macbook inplace/bin/ghc-stage2 --interactive 4038.hs
 GHCi, version 7.1.20110302: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 [1 of 1] Compiling Main ( 4038.hs, interpreted )
 Ok, modules loaded: Main.
 *Main main
 Bus error
 gwright-macbook
 }}}
 Under gdb, I get
 {{{
 gwright-macbook gdb
 GNU gdb 6.3.50-20050815 (Apple version gdb-1510) (Wed Sep 22 02:45:02 UTC
 2010)
 Copyright 2004 Free Software Foundation, Inc.
 GDB is free software, covered by the GNU General Public License, and you
 are
 welcome to change it and/or distribute copies of it under certain
 conditions.
 Type show copying to see the conditions.
 There is absolutely no warranty for GDB.  Type show warranty for
 details.
 This GDB was configured as x86_64-apple-darwin.
 (gdb) source gdbinit
 (gdb) source gdb_ghc
 Reading symbols for shared libraries . done
 (gdb) run
 Starting program: /Users/gwright/tmp/ghc-7-branch/ghc/inplace/lib/ghc-
 stage2 +RTS -V0 -i0 -RTS -B/Users/gwright/tmp/ghc-7-branch/ghc/inplace/lib
 -pgmc /usr/bin/gcc-4.2 -pgma /usr/bin/gcc-4.2 -pgml /usr/bin/gcc-4.2 -pgmP
 /usr/bin/gcc-4.2 -E -undef -traditional --interactive 4038.hs
 Reading symbols for shared libraries . done
 GHCi, version 7.0.1.20101221: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 [1 of 1] Compiling Main ( 4038.hs, interpreted )
 Ok, modules loaded: Main.
 *Main main

 Program received signal EXC_BAD_ACCESS, Could not access memory.
 Reason: KERN_PROTECTION_FAILURE at address: 0x000104300fd8
 [Switching to process 249]
 0x000101f3d8a9 in stg_makeStablePtrzh ()
 (gdb)
 }}}
 The `gdb_ghc` file used to start `gdb` contained:
 {{{
 file /Users/gwright/tmp/ghc-7-branch/ghc/inplace/lib/ghc-stage2
 set args +RTS -V0 -i0 -RTS
 -B/Users/gwright/tmp/ghc-7-branch/ghc/inplace/lib -pgmc /usr/bin/gcc-4.2
 -pgma /usr/bin/gcc-4.2 -pgml /usr/bin/gcc-4.2 -pgmP /usr/bin/gcc-4.2 -E
 -undef -traditional --interactive 4038.hs
 }}}
 I had copied the failing `4038.hs` file to the top level directory.

 The address of the failure, `0x104300fd8`, is in the block of memory
 mapped by the linker for `HSghc-prim-0.2.0.0.o`.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5003
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


[GHC] #5004: yesod-0.7.1 fails to build on ghc 7.0.2

2011-03-07 Thread GHC
#5004: yesod-0.7.1 fails to build on ghc 7.0.2
---+
Reporter:  pbrisbin|   Owner:
Type:  bug |  Status:  new   
Priority:  normal  |   Component:  Compiler  
 Version:  7.0.2   |Keywords:
Testcase:  |   Blockedby:
  Os:  Linux   |Blocking:
Architecture:  x86_64 (amd64)  | Failure:  Compile-time crash
---+
 Arch linux's ghc package was upgraded to 7.0.2 this weekend. I
 unregistered all cabal packages, removed ~/.cabal/packages/*/* and ~/.ghc
 in an effort to start fresh.

 I successfully installed quite a few packages via cabal install.

 You can find my current `ghc-pkg list`
 [http://pbrisbin.com/static/fileshare/ghc_list.txt here].

 At `cabal install yesod`, I get the following:

 {{{
 ...
 Loading package MonadCatchIO-mtl-0.3.0.2 ... linking ... done.
 Loading package Cabal-1.10.1.0 ... linking ... done.
 Loading package ghc-binary-0.5.0.2 ... linking ... done.
 Loading package bin-package-db-0.0.0.0 ... linking ... done.
 Loading package hpc-0.5.0.6 ... linking ... done.
 Loading package ghc-7.0.2 ... ghc: This ELF file contains no symtab
 ghc: panic! (the 'impossible' happened)
   (GHC version 7.0.2 for x86_64-unknown-linux):
 loadArchive /usr/lib/ghc-7.0.2/ghc-7.0.2/libHSghc-7.0.2.a:
 failed

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

 cabal: Error: some packages failed to install:
 yesod-0.7.1 failed during the building phase. The exception was:
 ExitFailure 1
 }}}

 I'm reporting here because I was specifically asked to by ghc (I almost
 always assume these things are my fault), please let me know what
 additional info you would like in this report.

 Thanks.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5004
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #5004: yesod-0.7.1 causes panic on Arch's ghc 7.0.2 (was: yesod-0.7.1 fails to build on ghc 7.0.2)

2011-03-07 Thread GHC
#5004: yesod-0.7.1 causes panic on Arch's ghc 7.0.2
---+
Reporter:  pbrisbin|   Owner:
Type:  bug |  Status:  new   
Priority:  normal  |   Component:  Compiler  
 Version:  7.0.2   |Keywords:
Testcase:  |   Blockedby:
  Os:  Linux   |Blocking:
Architecture:  x86_64 (amd64)  | Failure:  Compile-time crash
---+

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5004#comment:1
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #4247: getCPUTime on x86_64 Mac OS X 10.6

2011-03-07 Thread GHC
#4247: getCPUTime on x86_64 Mac OS X 10.6
---+
Reporter:  quark   |Owner:  igloo  
Type:  bug |   Status:  new
Priority:  normal  |Milestone:  7.2.1  
   Component:  libraries/base  |  Version:  6.10.4 
Keywords:  | Testcase: 
   Blockedby:  |   Difficulty: 
  Os:  MacOS X | Blocking: 
Architecture:  x86_64 (amd64)  |  Failure:  Incorrect result at runtime
---+

Comment(by gwright):

 This is essentially the same bug as #4970, so it looks like more than one
 file needs to be fixed.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4247#comment:8
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #1408: groupWhen – a groupBy that compares consecutive values

2011-03-07 Thread GHC
#1408: groupWhen – a groupBy that compares consecutive values
--+-
  Reporter:  Joachim Breitner mail@…|  Owner: 
 
  Type:  feature request  | Status:  
closed  
  Priority:  normal   |  Milestone: 
 
 Component:  libraries/base   |Version:  
7.0.2   
Resolution:  wontfix  |   Keywords: 
 
  Testcase:   |  Blockedby: 
 
Difficulty:  Easy (less than 1 hour)  | Os:  
Unknown/Multiple
  Blocking:   |   Architecture:  
Unknown/Multiple
   Failure:  None/Unknown |  
--+-
Changes (by Remi):

 * cc: rturk@… (added)


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/1408#comment:10
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #4318: Crash while building HEAD on OS X

2011-03-07 Thread GHC
#4318: Crash while building HEAD on OS X
---+
Reporter:  gwright |Owner: 
Type:  bug |   Status:  new
Priority:  normal  |Milestone:  7.2.1  
   Component:  Compiler|  Version:  6.13   
Keywords:  | Testcase: 
   Blockedby:  |   Difficulty: 
  Os:  MacOS X | Blocking: 
Architecture:  x86_64 (amd64)  |  Failure:  Building GHC failed
---+

Comment(by gwright):

 This bug should be closed.  The patch that fixed most of the problem
 (incorrect lookup of external symbols) was applied although I didn't
 attach the patch to this ticket. The most obvious remaining linker bug was
 repaired by #4867.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4318#comment:21
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #4995: Compiling pandoc with llvm backend fails with panic

2011-03-07 Thread GHC
#4995: Compiling pandoc with llvm backend fails with panic
+---
Reporter:  jgm  |Owner:  dterei  
Type:  bug  |   Status:  new 
Priority:  normal   |Milestone:  7.2.1   
   Component:  Compiler (LLVM)  |  Version:  7.0.2   
Keywords:  llvm pandoc  | Testcase:  
   Blockedby:   |   Difficulty:  
  Os:  MacOS X  | Blocking:  
Architecture:  x86  |  Failure:  None/Unknown
+---

Comment(by dterei):

 jgm would you be able to do this for me please:

 {{{
 ghc -fllvm -O2 -c -keep-llvm-files -keep-s-files
 src/Text/Pandoc/Readers/LaTeX.hs
 }}}

 Then send me/attach to this bug the LaTex.s and LaTeX.ll files that should
 appear. I have only limited access to an OSX machine, enough to build ghc
 and run the ghc test suite but installing cabal packages gets a little
 difficult. So I think this will be the quickest and easiest way for me to
 be able to fix the problem.

 Thanks

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4995#comment:5
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #4995: Compiling pandoc with llvm backend fails with panic

2011-03-07 Thread GHC
#4995: Compiling pandoc with llvm backend fails with panic
+---
Reporter:  jgm  |Owner:  dterei  
Type:  bug  |   Status:  new 
Priority:  normal   |Milestone:  7.2.1   
   Component:  Compiler (LLVM)  |  Version:  7.0.2   
Keywords:  llvm pandoc  | Testcase:  
   Blockedby:   |   Difficulty:  
  Os:  MacOS X  | Blocking:  
Architecture:  x86  |  Failure:  None/Unknown
+---

Comment(by jgm):

 Unfortunately there's a 256K limit on attachments, and these files are far
 larger.
 {{{
 -rw-r--r--  1 jgm  jgm  31678880 Mar  7 19:00
 src/Text/Pandoc/Readers/LaTeX.ll
 -rw-r--r--  1 jgm  jgm   9603608 Mar  7 19:00
 src/Text/Pandoc/Readers/LaTeX.s
 }}}

 Should I email them to you?  If so, send me an email directly so I know
 where to send them.
 jgm at berkeley dot edu

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4995#comment:6
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #5003: test 4038 (ghci) fails on OS X 64 bit.

2011-03-07 Thread GHC
#5003: test 4038 (ghci) fails on OS X 64 bit.
---+
Reporter:  gwright |   Owner:  gwright  
Type:  bug |  Status:  new  
Priority:  normal  |   Component:  GHCi 
 Version:  7.0.2   |Keywords:   
Testcase:  |   Blockedby:   
  Os:  MacOS X |Blocking:   
Architecture:  x86_64 (amd64)  | Failure:  Runtime crash
---+
Changes (by PHO):

 * cc: pho@… (added)


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5003#comment:2
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: [GHC] #4867: ghci displays negative floats incorrectly (was: Incorrect result from trig functions)

2011-03-07 Thread GHC
#4867: ghci displays negative floats incorrectly (was: Incorrect result from 
trig
functions)
--+-
  Reporter:  gwright  |  Owner:  gwright   
  Type:  bug  | Status:  closed
  Priority:  high |  Milestone:  7.0.2 
 Component:  GHCi |Version:  7.0.1 
Resolution:  fixed|   Keywords:
  Testcase:   |  Blockedby:
Difficulty:   | Os:  MacOS X   
  Blocking:   |   Architecture:  x86_64 (amd64)
   Failure:  Incorrect result at runtime  |  
--+-
Changes (by PHO):

 * cc: pho@… (added)


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4867#comment:50
GHC http://www.haskell.org/ghc/
The Glasgow Haskell Compiler

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


Re: semaphore functions in the wrong place during cross-build

2011-03-07 Thread Tyler Pirtle
On Sat, Mar 5, 2011 at 4:39 PM, Ian Lynagh ig...@earth.li wrote:
 On Fri, Mar 04, 2011 at 10:46:13AM -0800, Tyler Pirtle wrote:

 I'm not sure where the right place is to configure this. While linking
 hsunix + some others, the
 compiler assumes that -lrt is the appropriate library to find
 semaphore-related functions,
 but for the particular toolchain i'm building against, those functions
 are actually in -lpthread.

 Is there an easy way i can configure this?

 What version are you using? This sounds like it might be:
 http://hackage.haskell.org/trac/ghc/ticket/4523


Ah! It was a bug in 7.0.1 indeed. 7.0.2 fixed it. Thanks, Ian!

 Fixed in 7.0.2 and HEAD.


 Thanks
 Ian



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


Re: Configuring specific packges in libraries/ during ghc build

2011-03-07 Thread Tyler Pirtle
I ultimately found what I was looking for, but i'm wondering if there's
a better source of documentation for it. There are variables
strewn around the build system that look like:

libraries/time_dist-install_EXTRA_HC_OPTS += -fno-warn-unused-do-bind

Or, sometimes more generally,

$1_$2_CONFIGURE_OPTS += --enable-shared

By looking at the last bit of these variables I'm able to configure my
package correctly
and so it's al very good (and i can define these in my mk/build.mk). But is
there a listing of ALL of the suffixes that are available here
(CONFIGURE_OPTS, CC_OPTS,
HC_OPTS, etc) ?




On Fri, Mar 4, 2011 at 1:04 PM, Tyler Pirtle tee...@gmail.com wrote:
 My toolchain is a little silly. ;)

 It doesn't have ncurses in the obvious place, so by the time my build
 gets around to doing libraries/terminfo,
 the terminfo configure bails because it can't find the curses headers.

 I can work around this, by building the library manually, but is there
 an easy way for me to get a hold of
 specific cabal options when calling specific packages during build?


 inplace/bin/ghc-cabal configure
 --with-ghc=/home/teeler/Downloads/ghc-7.0.2/inplace/bin/dummy-ghc
 --with-ghc-pkg=/home/teeler/Downloads/ghc-7.0.2/inplace/bin/ghc-pkg
 --with-gcc=/some/weird/bin/gcc
 --configure-option=--with-cc=/some/weird/bin/gcc
 --enable-library-for-ghci --configure-option=CFLAGS=
 -fno-stack-protector   --configure-option=LDFLAGS=   
 --configure-option=CPPFLAGS=    -- dist-install libraries/terminfo


 I need to add some extra options to the configure command here.


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


bin-package-db

2011-03-07 Thread 山本和彦
Hello,

The release note of GHC 7.0.2 says:


1.5.6.3. bin-package-db

This is an internal package, and should not be used. 


What is the intention of this change?

The author of cabal-delete hesitates to register cabal-delete into
HackageDB due to this words.

Shouldn't a package-maintenance command even use this package? If so,
what package should be used?

--Kazu

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


Re: [Haskell] ANNOUNCE: silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread Bas van Dijk
On 7 March 2011 02:28, Trystan Spangler trysta...@comcast.net wrote:
 Announcing Silently, a package with two simple functions to run an IO action
 while preventing it from writing to stdout (or the given handle)

Useful package!

I tiny remark about the code:

-- | Run an IO action while ignoring all output to stdout.
silently :: IO a - IO a
silently = hSilently stdout

-- | Run an IO action while ignoring all output to the given handle.
hSilently :: Handle - IO a - IO a
hSilently handle action = do
  oldHandle - hDuplicate handle
  (tmpFile, tmpHandle) - openTempFile . silently
  hDuplicateTo tmpHandle handle
  finally action (hDuplicateTo oldHandle handle  hClose tmpHandle 
removeFile tmpFile)

Think about what happens if an asynchronous exception is thrown to the
thread executing hSilently just after opening the temp file. It will
abort the computation which causes the temp file to be left on your
system and keep the tmpHandle open.

You need to use bracket to ensure the temp file we always be closed and deleted.

I send you a pull-request.

Regards,

Bas

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


Re: [arch-haskell] Spec ready to go!

2011-03-07 Thread Peter Simons
Hi Rémy,

  Is there anything depending on haskell-packedstring in the haskell repo?

no, there isn't. The package appears to be obsolete.

Take care,
Peter


___
arch-haskell mailing list
arch-hask...@haskell.org
http://www.haskell.org/mailman/listinfo/arch-haskell


[Haskell] ANNOUNCE: silently-0.0.2 (thread safe and can capture output)

2011-03-07 Thread Trystan Spangler
Silently has doubled in size with two new functions to capture the output of an 
IO action:

  capture :: IO a - IO (String, a)
  hCapture :: Handle - IO a - IO (String, a)

All 4 functions now clean up any temp file even if there's an asynchronous 
exception but it still uses temp files behind-the-scenes; I'll get to that when 
I can in a week or so.

http://hackage.haskell.org/package/silently
https://github.com/trystan/silently

A big thanks to everyone who had comments and suggestions!
Trystan Spangler
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] Linker flags for foreign export.

2011-03-07 Thread Jason Dusek
  I am having no luck generating a foreign export and calling it
  from C. The problem seems to be that I must spoon feed the linker.
  My working example is the files under this directory on Github:


https://github.com/solidsnack/bash/tree/106e4de8358a726984d54859fb0b4aeaf264156f/hs/exports

  Running `make' to produce the executable that imports the
  binding yields a number of unresolved linkages:

:;  make import
ghc --make -fPIC -dynamic -c exports.hs
[1 of 1] Compiling LanguageBashExports ( exports.hs, exports.o )
ghc -shared exports.o exports_stub.o -o exports.so \
  -L/usr/lib/ghc-6.12.1/ -lHSrts \
  -L/usr/lib/ghc-6.12.1/ghc-prim-0.2.0.0/ -lHSghc-prim-0.2.0.0 \
  -L/usr/lib/ghc-6.12.1/integer-gmp-0.2.0.0/ -lHSinteger-gmp-0.2.0.0 \
  -L/usr/lib/ghc-6.12.1/base-4.2.0.0/ -lHSbase-4.2.0.0 \
  -lffi
gcc -g -Wall -O2 -fPIC -Wall -o import \
  -I/usr/lib/ghc-6.12.1/include/ \
  import.c exports.so
exports.so: undefined reference to `timer_settime'
exports.so: undefined reference to `__stginit_base_DataziWord_dyn'
exports.so: undefined reference to `clock_gettime'
exports.so: undefined reference to `__stginit_base_Prelude_dyn'
exports.so: undefined reference to `__stginit_base_ForeignziCziTypes_dyn'
exports.so: undefined reference to `timer_delete'
exports.so: undefined reference to `timer_create'
exports.so: undefined reference to `hs_free_stable_ptr'
collect2: ld returned 1 exit status
make: *** [import] Error 1

  If I add linker directives for libHSrts and librt to the
  compilation of import.c, the only unresolved symbols remaining
  are the STG init functions for the Prelude, Data.Word and
  Foreign.C.Types:

:;  make import
gcc -g -Wall -O2 -fPIC -Wall -o import \
  -I/usr/lib/ghc-6.12.1/include/ \
  import.c exports.so \
  -L/usr/lib/ghc-6.12.1/ -lHSrts \
  -lrt
exports.so: undefined reference to `__stginit_base_DataziWord_dyn'
exports.so: undefined reference to `__stginit_base_Prelude_dyn'
exports.so: undefined reference to `__stginit_base_ForeignziCziTypes_dyn'
collect2: ld returned 1 exit status
make: *** [import] Error 1

  This hide and go seek with symbols really makes me feel like
  I'm just doing it wrong, though. I linked exports.so
  statically so why shouldn't it include `hs_free_stable_ptr'
  already (as well as the stginit functions)? Not sure why I
  need to mention librt at this step and not at the previous
  one. The truth is, I don't write C very often and in fact I am
  only doing this to create a bridge to Ruby.

  How should I be approaching this? Is there an SO-chasing
  option?

--
Jason Dusek
Linux User #510144 | http://counter.li.org/

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
I use kate too.

I tried and liked leksah, but the fact that everything is a project
with a cabal file felt to heavy for me when I just want to hack on a
single .hs file.

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


Re: [Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-07 Thread Bas van Dijk
Sterling, Gregory, Brandon and David thanks for your suggestions.

On 6 March 2011 05:38, David Anderson d...@natulte.net wrote:
 I humbly recommend doing such daemonizations from outside your program.
 Programs that daemonize on startup make it very difficult to monitor them by
 direct means, instead forcing you to rely on PID files and other mechanisms
 which may not always be available or fresh.

Agreed, I already noticed that debugging is a bit harder since I have
no stdout and stderr anymore.

 For reference, Upstart, the new PID 1 on Ubuntu and friends, has a horrible
 hack[1] built in specifically to keep track of processes that helpfully
 daemonize themselves, so that it can offer additional services like
 restarting crashed services or notifying the owner of a problem.
 As has been pointed out elsewhere on thread, there are plenty of standalone
 programs that implement daemonization if you end up not using service
 management software to do it for you.

I plan to run the daemon on a Ubuntu server. Do you know if Upstart is
able to daemonize a process?

Regards,

Bas

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


Re: [Haskell-cafe] How to daemonize a threaded Haskell program?

2011-03-07 Thread David Anderson
On Mon, Mar 7, 2011 at 12:39 AM, Bas van Dijk v.dijk@gmail.com wrote:

 Sterling, Gregory, Brandon and David thanks for your suggestions.

 On 6 March 2011 05:38, David Anderson d...@natulte.net wrote:
  I humbly recommend doing such daemonizations from outside your program.
  Programs that daemonize on startup make it very difficult to monitor them
 by
  direct means, instead forcing you to rely on PID files and other
 mechanisms
  which may not always be available or fresh.

 Agreed, I already noticed that debugging is a bit harder since I have
 no stdout and stderr anymore.

  For reference, Upstart, the new PID 1 on Ubuntu and friends, has a
 horrible
  hack[1] built in specifically to keep track of processes that helpfully
  daemonize themselves, so that it can offer additional services like
  restarting crashed services or notifying the owner of a problem.
  As has been pointed out elsewhere on thread, there are plenty of
 standalone
  programs that implement daemonization if you end up not using service
  management software to do it for you.

 I plan to run the daemon on a Ubuntu server. Do you know if Upstart is
 able to daemonize a process?


It's perfectly simple. In fact, it's the default assumption of Upstart that
your program doesn't daemonize, and that Upstart should help it. You have to
specify if your program violates that assumption.

Here's a sample file. It specifies a service that; should run whenever the
main runlevels are entered (i.e. basic system init like mounting filesystems
is done, but no other guarantee); stops when the system leaves those
runlevels; runs a binary that does not fork or daemonize; respawns the
service if the process should die for any reason; can be manually stopped
and restarted by the admin if he feels like it.

$ cat /etc/init/demo.conf
description Demo service that doesn't daemonize by itself
start on runlevel [2345]
stop on runlevel [!2345]
respawn
exec /path/to/binary
$ sudo start demo
demo start/running, process 27469
$ sudo stop demo
demo stop/waiting
$ sudo status demo
demo stop/waiting
$

Hope this helps. The upstart configuration format is a little sparsely
documented, when I wrote scripts for it, I used the existing files in
/etc/init as a rough guide.

- Dave


 Regards,

 Bas

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Max Bolingbroke
Hi Remi,

On 6 March 2011 13:38, Remi Turk rt...@science.uva.nl wrote:
 I am happy to finally announce cinvoke 0.1, a binding to the
 C library cinvoke[1], allowing functions to be loaded and called
 whose names and types are not known before run-time.

As the author of the libffi package
(http://hackage.haskell.org/package/libffi-0.1) which does a similar
thing, could you say when it would be appropriate to use one or the
other package?

Cheers,
Max

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


[Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Hauschild, Klaus (EXT)
Hi,

to solve this ICFP task http://www.cs.cornell.edu/icfp/task.htm I'm currnetly 
working on the parser. With the hint from Thu (reading Phillip Wadlers monadic 
parser paper) and consulting 
http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing I 
produce a first working version of the parser.
After this great moment I completed the token definition and near all parsing 
rules. For the complete code have a look at 
http://code.google.com/p/hgmltracer/source/browse/#svn%2Ftrunk%2FhGmlTracer

data GmlToken =

-- structures

FunctionToken TokenSequence |

ArrayToken TokenSequence|

-- control operators

ApplyToken  |

IfToken |

-- number operators

AddiToken   |

AddfToken   |

ACosToken   |

ASinToken   |

ClampfToken |

CosToken|

DiviToken   |

DivfToken   |

EqiToken|

EqfToken|

FloorToken  |

FracToken   |

LessiToken  |

LessfToken  |

ModiToken   |

MuliToken   |

MulfToken   |

NegiToken   |

NegfToken   |

ToRealToken |

SinToken|

SqrtToken   |

SubiToken   |

SubfToken   |

-- points

GetXToken   |

GetYToken   |

GetZToken   |

PointToken  |

-- arrays

GetToken|

LengthToken |

-- environment

IdentifierToken String  |

BinderToken String  |

-- types

BoolToken Bool  |

IntToken Int|

RealToken Double|

StringToken String  deriving Show

And

parseGml :: String - [GmlToken]

parseGml input = case parse parseList gml input of

Left err - error (Parse error:  ++ (show err))

Right gml - gml



parseList = sepBy parseGml' spaces



parseGml' =

-- structures

--parseFunction

--| parseArray

-- control operators

parseControlOperators

-- number operators

| parseNumberOperators

-- points

| parsePointOperators

-- arrays

| parseArrayOperators

-- types

| parseBool

| parseInteger

| parseString

-- environment

| parseIdentifier

| parseBinder



parseArray = parseSequence '[' ']'

parseFunction = parseSequence '{' '}'

parseSequence start end = do char start

 array - parseList

 char end

 return $ ArrayToken array



parseControlOperators = parseApply | parseIf

parseApply = do string apply

return $ ApplyToken

parseIf = do string if

 return $ IfToken



parseNumberOperators = do string addi

  return $ AddiToken

   | do string addf

  return $ AddfToken

   | do string acos

  return $ ACosToken

   | do string asind

  return $ ASinToken

   | do string clampf

  return $ ClampfToken

   | do string cos

  return $ CosToken

   | do string divi

  return $ DiviToken

   | do string divf

  return $ DivfToken

   | do string eqi

  return $ EqiToken

   | do string eqf

  return $ EqfToken

   | do string floor

  return $ FloorToken

   | do string frac

  return $ FracToken

   | do string lessi

  return $ LessiToken

   | do string lessf

  return $ LessfToken

   | do string modi

  return $ ModiToken

   | do string muli

  return $ MuliToken

   | do string mulf

  return $ MulfToken

   | do string negi

  return $ NegiToken

  

[Haskell-cafe] Explicitly Typed Exceptions in Haskell 98 (Was: Idiomatic error handling in Haskell)

2011-03-07 Thread Henning Thielemann


On Wed, 2 Mar 2011, Henning Thielemann wrote:


On Wed, 2 Mar 2011, Rouan van Dalen wrote:

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


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

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



I recently had an idea of how to design extensible explicit type safe 
exceptions in Haskell 98, i.e. with single parameter type classes and 
non-overlapping instances. It seems to work quite well, the only drawback 
is that you have to define n^2 instances for n exceptions. This is much 
inspired by:

  http://users.dsic.upv.es/~jiborra/papers/explicitexceptions.pdf


Consider two exceptions: ReadException and WriteException. In order to be 
able to freely combine these exceptions, we use type classes, since type 
constraints of two function calls are automatically merged.


import Control.Monad.Exception.Synchronous (ExceptionalT, )

class ThrowsRead  e where throwRead  :: e
class ThrowsWrite e where throwWrite :: e

readFile  :: ThrowsRead  e = FilePath - ExceptionalT e IO String
writeFile :: ThrowsWrite e = FilePath - String - ExceptionalT e IO ()


For example for

copyFile src dst =
   writeFile dst = readFile src

the compiler automatically infers

copyFile ::
  (ThrowsWrite e, ThrowsRead e) =
  FilePath - FilePath - ExceptionalT e IO ()


Instead of ExceptionalT you can also use EitherT or ErrorT. It's also 
simple to add parameters to throwRead and throwWrite, such that you can 
pass more precise information along with the exception. I just want to 
keep it simple for now.


With those definitions you can already write a nice library and defer the 
decision of the particular exception types to the library user. The user 
might define something like


data ApplicationException =
 ReadException
   | WriteException

instance ThrowsRead ApplicationException where
   throwRead = ReadException

instance ThrowsWrite ApplicationException where
   throwWrite = WriteException


Using ApplicationException however it is cumbersome to handle only 
ReadException and propagate WriteException. The user might write 
something like


  case e of
 ReadException - handleReadException
 WriteException - throwT throwWrite

in order to handle a ReadException and regenerate a 'ThrowWrite e = e' 
type variable, instead of the concrete ApplicationException type.


He may choose to switch on multi-parameter type classes and overlapping 
instances, define an exception type like 'data EE l' and then use the 
technique from control-monad-exception for exception handling with the 
ExceptionalT monads.


Now I like to propose a technique for handling a particular set of 
exceptions in Haskell 98:


data ReadException e =
 ReadException
   | NoReadException e

instance ThrowsRead (ReadException e) where
throwRead = ReadException

instance ThrowsWrite e = ThrowsWrite (ReadException e) where
throwWrite = NoReadException throwWrite


data WriteException e =
 WriteException
   | NoWriteException e

instance ThrowsRead e = ThrowsRead (WriteException e) where
throwRead = NoWriteException throwRead

instance ThrowsWrite (WriteException e) where
throwWrite = WriteException



Defining exception types as a sum of this particular exception and 
another exception lets us compose concrete types that can carry a 
certain set of exceptions on the fly. This is very similar to switching 
from particular monads to monad transformers. Thanks to the type class 
approach the order of composition needs not to be fixed by the throwing 
function but is determined by the order of catching. We even do not have 
to fix the nested exception type fully when catching an exception. It is 
enough to fix the part that is interesting for 'catch':



import Control.Monad.Exception.Synchronous (Exceptional(Success,Exception))

catchRead :: ReadException e - Exceptional e String
catchRead ReadException = Success catched a read exception
catchRead (NoReadException e) = Exception e

throwReadWrite :: (ThrowsRead e, ThrowsWrite e) = e
throwReadWrite =
   asTypeOf throwRead throwWrite

exampleCatchRead :: (ThrowsWrite e) = Exceptional e String
exampleCatchRead =
   catchRead throwReadWrite


Note how in exampleCatchRead the constraint ThrowsRead is removed from the 
constraint list of throwReadWrite.


As I said, the nasty thing is, that the library has to define n^2 
instances for n exceptions. Even worse, if an application imports package 
A and package B with their sets of exceptions, you have to make the 
exception types of A instances of the exception class of B and vice versa, 
and these are orphan instances.


However I am still uncertain, how sophisticated an exception system really 
must be. In principle it must be 

Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Christian Maeder
You should parse keywords using:

keyword s = try (string s)  notFollowedBy (letter | digit)

C.

Am 07.03.2011 11:34, schrieb Hauschild, Klaus (EXT):
 Hi,
  
 to solve this ICFP task _http://www.cs.cornell.edu/icfp/task.htm_ I'm
 currnetly working on the parser. With the hint from Thu (reading Phillip
 Wadlers monadic parser paper) and consulting
 _http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing_
 I produce a first working version of the parser.
 After this great moment I completed the token definition and near all
 parsing rules. For the complete code have a look at
 _http://code.google.com/p/hgmltracer/source/browse/#svn%2Ftrunk%2FhGmlTracer_
  
 data GmlToken =

 -- structures

 FunctionToken TokenSequence |

 ArrayToken TokenSequence|

 -- control operators

 ApplyToken  |

 IfToken |

 -- number operators

 AddiToken   |

 AddfToken   |

 ACosToken   |

 ASinToken   |

 ClampfToken |

 CosToken|

 DiviToken   |

 DivfToken   |

 EqiToken|

 EqfToken|

 FloorToken  |

 FracToken   |

 LessiToken  |

 LessfToken  |

 ModiToken   |

 MuliToken   |

 MulfToken   |

 NegiToken   |

 NegfToken   |

 ToRealToken |

 SinToken|

 SqrtToken   |

 SubiToken   |

 SubfToken   |

 -- points

 GetXToken   |

 GetYToken   |

 GetZToken   |

 PointToken  |

 -- arrays

 GetToken|

 LengthToken |

 -- environment

 IdentifierToken String  |

 BinderToken String  |

 -- types

 BoolToken Bool  |

 IntToken Int|

 RealToken Double|

 StringToken String  deriving Show  
  
 And
  
 parseGml :: String - [GmlToken]

 parseGml input = case parse parseList gml input of

 Left err - error (Parse error:  ++ (show err))

 Right gml - gml

 

 parseList = sepBy parseGml' spaces

 

 parseGml' =

 -- structures

 --parseFunction

 --| parseArray

 -- control operators

 parseControlOperators

 -- number operators

 | parseNumberOperators

 -- points

 | parsePointOperators

 -- arrays

 | parseArrayOperators

 -- types

 | parseBool

 | parseInteger

 | parseString

 -- environment

 | parseIdentifier

 | parseBinder

 

 parseArray = parseSequence '[' ']'

 parseFunction = parseSequence '{' '}'

 parseSequence start end = do char start

  array - parseList

  char end

  return $ ArrayToken array

 

 parseControlOperators = parseApply | parseIf

 parseApply = do string apply

 return $ ApplyToken

 parseIf = do string if

  return $ IfToken

 

 parseNumberOperators = do string addi

   return $ AddiToken

| do string addf

   return $ AddfToken

| do string acos

   return $ ACosToken

| do string asind

   return $ ASinToken

| do string clampf

   return $ ClampfToken

| do string cos

Re: [Haskell-cafe] [Haskell] ANNOUNCE: silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread Felipe Almeida Lessa
Hello!

I wouldn't expect that a function that ignores the output directs it
to a temporary file.  I think that should be clearly stated on the
documentation, as this may be undesirable.  I don't know if there is a
better way of solving this problem, though.

(Note, however, that on Unix systems you could probably direct the
output to /dev/null.)

Cheers,

-- 
Felipe.

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


Re: [Haskell-cafe] groupBy huh?

2011-03-07 Thread Henning Thielemann
Jacek Generowicz schrieb:
 Hi Cafe,
 
 It seems that I don't understand what groupBy does.
 
 I expect it to group together elements as long as adjacent ones satisfy
 the predicate, so I would expect ALL four of the following to give one
 group of 3 and a group of 1.
 
 Prelude :m + Data.List
 Prelude Data.List groupBy () abcb
 [abcb]
 Prelude Data.List groupBy () abca
 [abc,a]
 Prelude Data.List groupBy () [1,2,3,2]
 [[1,2,3,2]]
 Prelude Data.List groupBy () [1,2,3,1]
 [[1,2,3],[1]]
 
 What am I missing?


http://hackage.haskell.org/packages/archive/utility-ht/0.0.5.1/doc/html/Data-List-HT.html#v:groupBy


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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Hauschild, Klaus (EXT)
Thanks Christian,

I adapted the keyword parser and now n - negi does not occur.

But there are still other problems to solve. If I activate the parseFunction 
the parser will answer to fact.gml unexpected end of input, expecting space or 
}.

Any ideas?


-Ursprüngliche Nachricht-
Von: Christian Maeder [mailto:christian.mae...@dfki.de] 
Gesendet: Montag, 7. März 2011 12:23
An: Hauschild, Klaus (EXT)
Cc: haskell-cafe@haskell.org
Betreff: Re: Overlaping Parsec rules

You should parse keywords using:

keyword s = try (string s)  notFollowedBy (letter | digit)

C.

Am 07.03.2011 11:34, schrieb Hauschild, Klaus (EXT):
 Hi,
  
 to solve this ICFP task _http://www.cs.cornell.edu/icfp/task.htm_ I'm
 currnetly working on the parser. With the hint from Thu (reading Phillip
 Wadlers monadic parser paper) and consulting
 _http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing_
 I produce a first working version of the parser.
 After this great moment I completed the token definition and near all
 parsing rules. For the complete code have a look at
 _http://code.google.com/p/hgmltracer/source/browse/#svn%2Ftrunk%2FhGmlTracer_
  
 data GmlToken =

 -- structures

 FunctionToken TokenSequence |

 ArrayToken TokenSequence|

 -- control operators

 ApplyToken  |

 IfToken |

 -- number operators

 AddiToken   |

 AddfToken   |

 ACosToken   |

 ASinToken   |

 ClampfToken |

 CosToken|

 DiviToken   |

 DivfToken   |

 EqiToken|

 EqfToken|

 FloorToken  |

 FracToken   |

 LessiToken  |

 LessfToken  |

 ModiToken   |

 MuliToken   |

 MulfToken   |

 NegiToken   |

 NegfToken   |

 ToRealToken |

 SinToken|

 SqrtToken   |

 SubiToken   |

 SubfToken   |

 -- points

 GetXToken   |

 GetYToken   |

 GetZToken   |

 PointToken  |

 -- arrays

 GetToken|

 LengthToken |

 -- environment

 IdentifierToken String  |

 BinderToken String  |

 -- types

 BoolToken Bool  |

 IntToken Int|

 RealToken Double|

 StringToken String  deriving Show  
  
 And
  
 parseGml :: String - [GmlToken]

 parseGml input = case parse parseList gml input of

 Left err - error (Parse error:  ++ (show err))

 Right gml - gml

 

 parseList = sepBy parseGml' spaces

 

 parseGml' =

 -- structures

 --parseFunction

 --| parseArray

 -- control operators

 parseControlOperators

 -- number operators

 | parseNumberOperators

 -- points

 | parsePointOperators

 -- arrays

 | parseArrayOperators

 -- types

 | parseBool

 | parseInteger

 | parseString

 -- environment

 | parseIdentifier

 | parseBinder

 

 parseArray = parseSequence '[' ']'

 parseFunction = parseSequence '{' '}'

 parseSequence start end = do char start

  array - parseList

  char end

  return $ ArrayToken array

 

 parseControlOperators = parseApply | parseIf

 parseApply = do string apply

 return $ ApplyToken

 parseIf = do string if

  return $ IfToken

 

 parseNumberOperators = do string addi

 

[Haskell-cafe] ghc in debian sid

2011-03-07 Thread rustom
I tried to move from debian testing to sid and got the message that a
whole load of libghc**'s would be removed.

Are more recent ones lined up?

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


Re: [Haskell-cafe] ghc in debian sid

2011-03-07 Thread rustom
There are other instabilities (sid is after all unstable) so staying
with testing for now.


On Mar 7, 5:59 pm, rustom rustompm...@gmail.com wrote:
 I tried to move from debian testing to sid and got the message that a
 whole load of libghc**'s would be removed.

 Are more recent ones lined up?

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

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Christian Maeder
Am 07.03.2011 13:48, schrieb Hauschild, Klaus (EXT):
 Thanks Christian,
 
 I adapted the keyword parser and now n - negi does not occur.
 
 But there are still other problems to solve. If I activate the parseFunction 
 the parser will answer to fact.gml unexpected end of input, expecting space 
 or }.

Your redefinition of spaces (= skipMany1 space) is problematic and:

 parseList = sepBy parseGml' spaces

Allow for the original (optional) spaces after parseGml':

  parseGml'' = liftM2 const parseGml' spaces

  parseList = many parseGml''

C.

P.S. why do you call? many (noneOf )

   manyTill anyChar newline

   or just: many (noneOf \n)

   (a trailing newline will be skipped by spaces)

 
 Any ideas?
 
 
 -Ursprüngliche Nachricht-
 Von: Christian Maeder [mailto:christian.mae...@dfki.de] 
 Gesendet: Montag, 7. März 2011 12:23
 An: Hauschild, Klaus (EXT)
 Cc: haskell-cafe@haskell.org
 Betreff: Re: Overlaping Parsec rules
 
 You should parse keywords using:
 
 keyword s = try (string s)  notFollowedBy (letter | digit)
 
 C.
 
 Am 07.03.2011 11:34, schrieb Hauschild, Klaus (EXT):
 Hi,
  
 to solve this ICFP task _http://www.cs.cornell.edu/icfp/task.htm_ I'm
 currnetly working on the parser. With the hint from Thu (reading Phillip
 Wadlers monadic parser paper) and consulting
 _http://en.wikibooks.org/wiki/Write_Yourself_a_Scheme_in_48_Hours/Parsing_
 I produce a first working version of the parser.
 After this great moment I completed the token definition and near all
 parsing rules. For the complete code have a look at
 _http://code.google.com/p/hgmltracer/source/browse/#svn%2Ftrunk%2FhGmlTracer_
  
 data GmlToken =

 -- structures

 FunctionToken TokenSequence |

 ArrayToken TokenSequence|

 -- control operators

 ApplyToken  |

 IfToken |

 -- number operators

 AddiToken   |

 AddfToken   |

 ACosToken   |

 ASinToken   |

 ClampfToken |

 CosToken|

 DiviToken   |

 DivfToken   |

 EqiToken|

 EqfToken|

 FloorToken  |

 FracToken   |

 LessiToken  |

 LessfToken  |

 ModiToken   |

 MuliToken   |

 MulfToken   |

 NegiToken   |

 NegfToken   |

 ToRealToken |

 SinToken|

 SqrtToken   |

 SubiToken   |

 SubfToken   |

 -- points

 GetXToken   |

 GetYToken   |

 GetZToken   |

 PointToken  |

 -- arrays

 GetToken|

 LengthToken |

 -- environment

 IdentifierToken String  |

 BinderToken String  |

 -- types

 BoolToken Bool  |

 IntToken Int|

 RealToken Double|

 StringToken String  deriving Show  
  
 And
  
 parseGml :: String - [GmlToken]

 parseGml input = case parse parseList gml input of

 Left err - error (Parse error:  ++ (show err))

 Right gml - gml



 parseList = sepBy parseGml' spaces



 parseGml' =

 -- structures

 --parseFunction

 --| parseArray

 -- control operators

 parseControlOperators

 -- number operators

 | parseNumberOperators

 -- points

 | parsePointOperators

 -- arrays

 | parseArrayOperators

 -- types

 | parseBool

 | parseInteger

 | parseString

 -- environment

 | parseIdentifier

 | parseBinder



 parseArray = parseSequence '[' ']'

 parseFunction = parseSequence '{' '}'

 parseSequence start end = do char start


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Stephen Tetley
Hi Klaus

Unless you have very specific white-space considerations, you really
want to be using Parsec's Token and LanguageDef modules.

There are examples in the legacy Parsec 2.0 distribution available
from Daan Leijen's old website:
http://legacy.cs.uu.nl/daan/parsec.html

Best wishes

Stephen

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Daniel Fischer
On Monday 07 March 2011 13:48:31, Hauschild, Klaus (EXT) wrote:
 But there are still other problems to solve.

One thing that I saw which wasn't mentioned before (or I missed it) is that 
you need to try parsing binders before parsing identifiers. Currently, all 
binders are happily accepted as identifiers.

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


Re: [Haskell-cafe] Overlaping Parsec rules

2011-03-07 Thread Christian Maeder
Am 07.03.2011 14:20, schrieb Stephen Tetley:
 Hi Klaus
 
 Unless you have very specific white-space considerations, you really
 want to be using Parsec's Token and LanguageDef modules.

Well, I would want to use Parsec's Token and LanguageDef modules just to
get the white spaces (and comments to be ignored) right.

Simply skip spaces and comments after every lexical token (by your own
wrapper function like Text.ParserCombinators.Parsec.Token.lexeme).

C.

 
 There are examples in the legacy Parsec 2.0 distribution available
 from Daan Leijen's old website:
 http://legacy.cs.uu.nl/daan/parsec.html
 
 Best wishes
 
 Stephen

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
2011/3/3 JP Moresmau jpmores...@gmail.com:

 Hello, I'm one of the maintainers of EclipseFP. It is a real
 alternative: it works, it is maintained, supported and enhanced. I use
 it for my own projects, and of course I use it to work on the version
 of the scion library that ships with it, so we eat our own dogfood
 :-). A new minor version is going to come out in the next couple of
 weeks. Why don't you give it a try? We appreciate any feedback!

from  http://eclipsefp.sourceforge.net/eclipsefp2.html I understand that
building scion is automatically done, but can be optionally done it it's too
long.
but from http://eclipsefp.sourceforge.net/build.html I see that I do have to
build it. But :

git clone http://github.com/JPMoresmau/scion.git
Initialized empty Git repository in /data/code/scion/.git/
remote: Counting objects: 3563, done.
remote: Compressing objects: 100% (1310/1310), done.
remote: Total 3563 (delta 2137), reused 3342 (delta 1970)
Receiving objects: 100% (3563/3563), 580.09 KiB | 395 KiB/s, done.

Resolving deltas: 100% (2137/2137), done.

david@pcdavid:~/code$ cd scion/

david@pcdavid:~/code/scion$ sudo cabal install
[sudo] password for david:
Resolving dependencies...
cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however
Cabal-1.8.0.6 was excluded because scion-0.1.0.8 requires Cabal ==1.6.*

I'm not sure what to do now. Trying to install eclipsefp without scion built
in case it works, but I'm not used to eclipse, I could use some screenshots
to take me step by step through the process. For example, My project menu
has open grayed, and file/import wants me to choose an import source (I
chose Existing project into workspace) but then do I copy projects into
workspace ( I did not )

I have eclipse already setup with android development (I have just a toy
project, I planned to learn about android programming), when I imported the
projects they appeared at the same place. Is there a way not to mix android
and haskell projects ? Do I create a new workspace, or assign working sets ?

Anyway the projects are in the workspace, and there's 123 warnings; but I
can't really tell if the build failed or not.
Selecting all the project, and right-click - refresh didn't seem to change
anything.

But it seems it worked, because step 7 does launch a new eclipse window, and
I can see haskell in the preferences. Except that I had an error message
regarding scion, and stupid me, clicked ok before I could remember what was
written.

I tried rebuild scion, but nothing seemed to happen. I closed the first
Eclipse window (the one that has all the eclipsefp projects in the package
explorer), but then the second one closed too. I lauched eclipse again, run
configurations, etc and this time it looks like scion is building (well
something happens in the Console tab)

While this is building, I'm wondering if there's a way to launch eclise
directly in the right mode. Not having to go to run configurations, etc.

Ah, the build failed. Complains that HUnit is missing. So I cabal install
it, close my Eclipse window, run configurations again on the first Eclipse
window, and the build resumes.

 And build success. Now to open a haskell source file and play with
Eclipse.

/feedback

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread David Virebayre
2011/3/7 David Virebayre dav.vire+hask...@gmail.com

  And build success. Now to open a haskell source file and play with
 Eclipse.


... and I keep having those Problem occurred popups:

'Occurrences has encountered a problem
An internal error has occurred.

In the detail:

An internal error has occurred.
java.lang.NullPointerException

In show error log tab, 3 messages; all have 'net.sf.eclipsefp.haskell.ui' in
the Plug-in column :
TWICE:
eclipse.buildId=M20100211-1343
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=fr_FR
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data
/data/code/eclipse/../runtime-New_configuration -dev
file:/data/code/eclipse/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties
-os linux -ws gtk -arch x86


Info
Mon Mar 07 15:15:13 CET 2011
cabal executable: /usr/local/bin/cabal, cabal-install 0.8.2, Cabal library
version 1.8.0.2

AND ONCE:
eclipse.buildId=M20100211-1343
java.version=1.6.0_20
java.vendor=Sun Microsystems Inc.
BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=fr_FR
Framework arguments:  -product org.eclipse.sdk.ide
Command-line arguments:  -product org.eclipse.sdk.ide -data
/data/code/eclipse/../runtime-New_configuration -dev
file:/data/code/eclipse/.metadata/.plugins/org.eclipse.pde.core/New_configuration/dev.properties
-os linux -ws gtk -arch x86


Info
Mon Mar 07 15:03:33 CET 2011
cabal executable: /home/david/bin/cabalinit, cabal-install , Cabal library
version

Cheers,

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread Alberto G. Corona
I use leksah, and I want to say thanks to the people that maintain it. I
want also to encourage them to continuing its valuable work.

from the last release of Leksah, I particulary appreciate its:

Multiplatform support
Ease of installation in all platforms including windows
capability to works with many cabal packages in a single workspace
its detection of dependencies and rebuilding of the affected packages
Integration of GHCI and the GHCI debugger
integrated building of documentation
referencing and navigation trough the  source of the installed packages
and of course all the other traditional IDE capabilities


2011/3/7 David Virebayre dav.vire+hask...@gmail.com

 2011/3/3 JP Moresmau jpmores...@gmail.com:


  Hello, I'm one of the maintainers of EclipseFP. It is a real
  alternative: it works, it is maintained, supported and enhanced. I use
  it for my own projects, and of course I use it to work on the version
  of the scion library that ships with it, so we eat our own dogfood
  :-). A new minor version is going to come out in the next couple of
  weeks. Why don't you give it a try? We appreciate any feedback!

 from  http://eclipsefp.sourceforge.net/eclipsefp2.html I understand that
 building scion is automatically done, but can be optionally done it it's too
 long.
 but from http://eclipsefp.sourceforge.net/build.html I see that I do have
 to build it. But :

 git clone http://github.com/JPMoresmau/scion.git
 Initialized empty Git repository in /data/code/scion/.git/
 remote: Counting objects: 3563, done.
 remote: Compressing objects: 100% (1310/1310), done.
 remote: Total 3563 (delta 2137), reused 3342 (delta 1970)
 Receiving objects: 100% (3563/3563), 580.09 KiB | 395 KiB/s, done.

 Resolving deltas: 100% (2137/2137), done.

 david@pcdavid:~/code$ cd scion/

 david@pcdavid:~/code/scion$ sudo cabal install
 [sudo] password for david:
 Resolving dependencies...
 cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however
 Cabal-1.8.0.6 was excluded because scion-0.1.0.8 requires Cabal ==1.6.*

 I'm not sure what to do now. Trying to install eclipsefp without scion
 built in case it works, but I'm not used to eclipse, I could use some
 screenshots to take me step by step through the process. For example, My
 project menu has open grayed, and file/import wants me to choose an import
 source (I chose Existing project into workspace) but then do I copy projects
 into workspace ( I did not )

 I have eclipse already setup with android development (I have just a toy
 project, I planned to learn about android programming), when I imported the
 projects they appeared at the same place. Is there a way not to mix android
 and haskell projects ? Do I create a new workspace, or assign working sets ?

 Anyway the projects are in the workspace, and there's 123 warnings; but I
 can't really tell if the build failed or not.
 Selecting all the project, and right-click - refresh didn't seem to change
 anything.

 But it seems it worked, because step 7 does launch a new eclipse window,
 and I can see haskell in the preferences. Except that I had an error message
 regarding scion, and stupid me, clicked ok before I could remember what was
 written.

 I tried rebuild scion, but nothing seemed to happen. I closed the first
 Eclipse window (the one that has all the eclipsefp projects in the package
 explorer), but then the second one closed too. I lauched eclipse again, run
 configurations, etc and this time it looks like scion is building (well
 something happens in the Console tab)

 While this is building, I'm wondering if there's a way to launch eclise
 directly in the right mode. Not having to go to run configurations, etc.

 Ah, the build failed. Complains that HUnit is missing. So I cabal install
 it, close my Eclipse window, run configurations again on the first Eclipse
 window, and the build resumes.

  And build success. Now to open a haskell source file and play with
 Eclipse.

 /feedback

 David.


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


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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread JP Moresmau
The eclipseFP Help forum or mailing list is probably a better medium
for EclipseFP questions than haskell-cafe, I'd say...
EclipseFP uses the scion library, but comes bundled with it, so it
should be able to build it (including downloading dependencies from
hackage) itself without you building scion manually (if you still want
to do it, there is a flag you can set to specify the version of Cabal
you're using).
I think you're confusing the instructions to install EclipseFP and use
it to develop in Haskell with the instructions on the build page that
are for people that wish to hack EclipseFP itself. Basically you need
to install EclipseFP using the Eclipse install new software features
and take it from there.
You can of course have different workspaces, one for your haskell
projects, one for your android projects, but it doesn't matter if you
have projects of different types in the same workspace.
Good luck, and if you're still confused feel free to contact me directly.

JP

On Mon, Mar 7, 2011 at 3:19 PM, David Virebayre
dav.vire+hask...@gmail.com wrote:
 2011/3/3 JP Moresmau jpmores...@gmail.com:

 Hello, I'm one of the maintainers of EclipseFP. It is a real
 alternative: it works, it is maintained, supported and enhanced. I use
 it for my own projects, and of course I use it to work on the version
 of the scion library that ships with it, so we eat our own dogfood
 :-). A new minor version is going to come out in the next couple of
 weeks. Why don't you give it a try? We appreciate any feedback!

 from  http://eclipsefp.sourceforge.net/eclipsefp2.html I understand that
 building scion is automatically done, but can be optionally done it it's too
 long.
 but from http://eclipsefp.sourceforge.net/build.html I see that I do have to
 build it. But :

 git clone http://github.com/JPMoresmau/scion.git
 Initialized empty Git repository in /data/code/scion/.git/
 remote: Counting objects: 3563, done.
 remote: Compressing objects: 100% (1310/1310), done.
 remote: Total 3563 (delta 2137), reused 3342 (delta 1970)
 Receiving objects: 100% (3563/3563), 580.09 KiB | 395 KiB/s, done.

 Resolving deltas: 100% (2137/2137), done.

 david@pcdavid:~/code$ cd scion/

 david@pcdavid:~/code/scion$ sudo cabal install
 [sudo] password for david:
 Resolving dependencies...
 cabal: dependencies conflict: ghc-6.12.3 requires Cabal ==1.8.0.6 however
 Cabal-1.8.0.6 was excluded because scion-0.1.0.8 requires Cabal ==1.6.*

 I'm not sure what to do now. Trying to install eclipsefp without scion built
 in case it works, but I'm not used to eclipse, I could use some screenshots
 to take me step by step through the process. For example, My project menu
 has open grayed, and file/import wants me to choose an import source (I
 chose Existing project into workspace) but then do I copy projects into
 workspace ( I did not )
 I have eclipse already setup with android development (I have just a toy
 project, I planned to learn about android programming), when I imported the
 projects they appeared at the same place. Is there a way not to mix android
 and haskell projects ? Do I create a new workspace, or assign working sets ?
 Anyway the projects are in the workspace, and there's 123 warnings; but I
 can't really tell if the build failed or not.
 Selecting all the project, and right-click - refresh didn't seem to change
 anything.
 But it seems it worked, because step 7 does launch a new eclipse window, and
 I can see haskell in the preferences. Except that I had an error message
 regarding scion, and stupid me, clicked ok before I could remember what was
 written.
 I tried rebuild scion, but nothing seemed to happen. I closed the first
 Eclipse window (the one that has all the eclipsefp projects in the package
 explorer), but then the second one closed too. I lauched eclipse again, run
 configurations, etc and this time it looks like scion is building (well
 something happens in the Console tab)
 While this is building, I'm wondering if there's a way to launch eclise
 directly in the right mode. Not having to go to run configurations, etc.
 Ah, the build failed. Complains that HUnit is missing. So I cabal install
 it, close my Eclipse window, run configurations again on the first Eclipse
 window, and the build resumes.
  And build success. Now to open a haskell source file and play with
 Eclipse.
 /feedback
 David.




-- 
JP Moresmau
http://jpmoresmau.blogspot.com/

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread Daniel Fischer
On Monday 07 March 2011 16:08:01, Alberto G. Corona wrote:
 I use leksah, and I want to say thanks to the people that maintain it. I
 want also to encourage them to continuing its valuable work.
 
 from the last release of Leksah, I particulary appreciate its:
 
 Multiplatform support
 Ease of installation in all platforms including windows
 capability to works with many cabal packages in a single workspace
 its detection of dependencies and rebuilding of the affected packages
 Integration of GHCI and the GHCI debugger
 integrated building of documentation
 referencing and navigation trough the  source of the installed packages
 and of course all the other traditional IDE capabilities

That sounds nice, so I thought I'd try out leksah again.

Unfortunately, the dependencies rule out GHC-7 (base  4.3, Cabal  1.9, 
containers  0.4 were the ones that sprang to the eyes immediately).
Bummer

Maybe someone could try relaxing the bounds and build it with GHC-7, and - 
if it works - upload a new version?
(I could try if I get a go-ahead from Hamish or Jürgen)

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


Re: [Haskell-cafe] [Haskell] ANNOUNCE: silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread trystan . s


Thanks for the feedback! I'll definitely update the documentation. I agree that 
temp files are a weird way to go about it but they're the least surprising and 
dangerous way I could think of handling it. 




Unix has /dev/null and Windows has a NUL device that works the same way so I 
could use those. 

* I could see what OS it is and try those options and use a temp file only if 
it's an unexpected os. Unfortunately System.Info.os reports windows (and some 
other os's) as mingw32, I think it's because of how GHC was compiled. Who 
knows what the real os is or what each os will be reported as in the future or 
how they appear to other compilers and runtimes. 

* I could write to /dev/null or NUL if they exist and use a temp file if 
neither does, but if there's a legitimate /dev/null or NUL file then having 
some unrelated program write to them would be very very bad and a major pain 
for whoever has to figure that one out. 




I'd rather not use temp files but both of these seem problematic. Does anyone 
have a better idea or think that either of those are acceptable? 




Trystan Spangler 


- Original Message - 
From: Felipe Almeida Lessa felipe.le...@gmail.com 
To: Trystan Spangler trysta...@comcast.net 
Cc: haskell-cafe@haskell.org 
Sent: Monday, March 7, 2011 3:41:07 AM 
Subject: Re: [Haskell] ANNOUNCE: silently-0.0.1 (prevent IO actions from 
writing to stdout) 

Hello! 

I wouldn't expect that a function that ignores the output directs it 
to a temporary file. I think that should be clearly stated on the 
documentation, as this may be undesirable. I don't know if there is a 
better way of solving this problem, though. 

(Note, however, that on Unix systems you could probably direct the 
output to /dev/null.) 

Cheers, 

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


Re: [Haskell-cafe] silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread Henning Thielemann


On Mon, 7 Mar 2011, trysta...@comcast.net wrote:


* I could see what OS it is and try those options and use a temp file only if 
it's an
unexpected os. Unfortunately System.Info.os reports windows (and some other 
os's) as
mingw32, I think it's because of how GHC was compiled. Who knows what the 
real os is
or what each os will be reported as in the future or how they appear to other 
compilers
and runtimes.


You could add a check to Cabal and then choose a platform-dependent module 
using


  If os(windows)
Hs-Source-Dirs: windows/src
  Else
Hs-Source-Dirs: unix/src

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


Re: [Haskell-cafe] silently-0.0.1 (prevent IO actions from writing to stdout)

2011-03-07 Thread trystan . s


I was not aware of that! Very cool. 




Trystan Spangler 



- Original Message - 
From: Henning Thielemann lemm...@henning-thielemann.de 
To: trystan s trysta...@comcast.net 
Cc: Felipe Almeida Lessa felipe.le...@gmail.com, haskell-cafe@haskell.org 
Sent: Monday, March 7, 2011 9:56:16 AM 
Subject: Re: silently-0.0.1 (prevent IO actions from writing to stdout) 


On Mon, 7 Mar 2011, trysta...@comcast.net wrote: 

 * I could see what OS it is and try those options and use a temp file only if 
 it's an 
 unexpected os. Unfortunately System.Info.os reports windows (and some other 
 os's) as 
 mingw32, I think it's because of how GHC was compiled. Who knows what the 
 real os is 
 or what each os will be reported as in the future or how they appear to other 
 compilers 
 and runtimes. 

You could add a check to Cabal and then choose a platform-dependent module 
using 

If os(windows) 
Hs-Source-Dirs: windows/src 
Else 
Hs-Source-Dirs: unix/src 
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 09:41:27AM +, Max Bolingbroke wrote:
 Hi Remi,
 
 On 6 March 2011 13:38, Remi Turk rt...@science.uva.nl wrote:
  I am happy to finally announce cinvoke 0.1, a binding to the
  C library cinvoke[1], allowing functions to be loaded and called
  whose names and types are not known before run-time.
 
 As the author of the libffi package
 (http://hackage.haskell.org/package/libffi-0.1) which does a similar
 thing, could you say when it would be appropriate to use one or the
 other package?
 
 Cheers,
 Max

Of course:

- libffi doesn't do library/function loading; you'll need to use
  System.Posix.DynamicLinker or System.Win32.DLL for that.
  cinvoke will not only load your libraries and functions,
  but even collect the garbage afterwards.
- Things seem to have changed, but back when I first looked at
  cinvoke, getting libffi to run under windows didn't seem too
  realistic.
- If you need to pass C structs (by value), you'll have to use
  libffi: cinvoke doesn't support them at all.
- The current version of libffi is not exception safe (I do have
  some code lying around here though...)
- cinvoke is actually haddockized (although hackage still hasn't
  generated the docs, apparently).

Groeten, Remi

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Gábor Lehel
On Mon, Mar 7, 2011 at 7:32 PM, Remi Turk rt...@science.uva.nl wrote:
 On Mon, Mar 07, 2011 at 09:41:27AM +, Max Bolingbroke wrote:
 Hi Remi,

 On 6 March 2011 13:38, Remi Turk rt...@science.uva.nl wrote:
  I am happy to finally announce cinvoke 0.1, a binding to the
  C library cinvoke[1], allowing functions to be loaded and called
  whose names and types are not known before run-time.

 As the author of the libffi package
 (http://hackage.haskell.org/package/libffi-0.1) which does a similar
 thing, could you say when it would be appropriate to use one or the
 other package?

 Cheers,
 Max

 Of course:

 - libffi doesn't do library/function loading; you'll need to use
  System.Posix.DynamicLinker or System.Win32.DLL for that.
  cinvoke will not only load your libraries and functions,
  but even collect the garbage afterwards.
 - Things seem to have changed, but back when I first looked at
  cinvoke, getting libffi to run under windows didn't seem too
  realistic.
 - If you need to pass C structs (by value), you'll have to use
  libffi: cinvoke doesn't support them at all.
 - The current version of libffi is not exception safe (I do have
  some code lying around here though...)
 - cinvoke is actually haddockized (although hackage still hasn't
  generated the docs, apparently).

It's reporting a build failure.


 Groeten, Remi

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




-- 
Work is punishment for failing to procrastinate effectively.

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Daniel Fischer
On Monday 07 March 2011 21:42:16, Gábor Lehel wrote:
 
 It's reporting a build failure.


Missing C library.

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 10:00:47PM +0100, Daniel Fischer wrote:
 On Monday 07 March 2011 21:42:16, Gábor Lehel wrote:
  
  It's reporting a build failure.
 
 
 Missing C library.

cinvoke (the C library) is obviously not installed on the testing machine.
Does that really mean no library with uncommon C dependencies
gets documentation on hackage?

Remi

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Daniel Fischer
On Monday 07 March 2011 22:14:38, Remi Turk wrote:
 On Mon, Mar 07, 2011 at 10:00:47PM +0100, Daniel Fischer wrote:
  On Monday 07 March 2011 21:42:16, Gábor Lehel wrote:
   It's reporting a build failure.
  
  Missing C library.
 
 cinvoke (the C library) is obviously not installed on the testing
 machine. Does that really mean no library with uncommon C dependencies
 gets documentation on hackage?
 
 Remi

Basically, yes. As far as I know, documentation is only built for libraries 
that build on hackage.

Maybe it would be a good idea to have the opportunity to upload haddock 
bundles to hackage too for such libraries.

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Remi Turk
On Mon, Mar 07, 2011 at 10:31:25PM +0100, Daniel Fischer wrote:
 On Monday 07 March 2011 22:14:38, Remi Turk wrote:
  cinvoke (the C library) is obviously not installed on the testing
  machine. Does that really mean no library with uncommon C dependencies
  gets documentation on hackage?
  
  Remi
 
 Basically, yes. As far as I know, documentation is only built for libraries 
 that build on hackage.
 
 Maybe it would be a good idea to have the opportunity to upload haddock 
 bundles to hackage too for such libraries.

That sucks :(
Uploading haddock bundles could solve the problem, though I don't
currently understand why being able to successfully configure a
package is a prerequisite to generating the docs.

Anyway, I just put the docs online somewhere else with a link
from the homepage: http://haskell.org/haskellwiki/Library/cinvoke

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread Alexander Solla
On Sat, Mar 5, 2011 at 5:06 AM, wren ng thornton w...@freegeek.org wrote:

 On 3/4/11 4:33 PM, Alexander Solla wrote:

 On Thu, Mar 3, 2011 at 10:14 PM, wren ng thorntonw...@freegeek.org
  wrote:

 On 3/3/11 2:58 AM, Antti-Juhani Kaijanaho wrote:

 On Thu, Mar 03, 2011 at 12:29:44PM +0530, Karthick Gururaj wrote:

  Thanks - is this the same unit that accompanies IO in IO () ? In
 any case, my question is answered since it is not a tuple.


 It can be viewed as the trivial 0-tuple.


 Except that this is problematic since Haskell doesn't have 1-tuples
 (which
 would be distinct from plain values in that they have an extra bottom).


  I don't get this line of thought.  I understand what you're saying, but
 why
 even bother trying to distinguish between bottoms when they can't be
 compared by equality, or even computed?


 If we have,

   data OneTuple a = One a

 Then

_|_ /= One _|_


That is vacuously true.  I will demonstrate the source of the contradiction
later.  But you also have _|_ == One _|_, by evaluation:

 Just undefined
Just *** Exception: Prelude.undefined



 This can be detected by seq: the left-hand side doesn't terminate, whereas
 the right-hand side does. And moreover, this can mess up other things (e.g.,
 monads) by introducing too much laziness. Space leaks are quite a serious
 matter and they have nothing to do with trying to compare uncomputable
 values. Do you want a seemingly insignificant refactoring to cause your
 program to suddenly hang forever? Or to take up gobs more space than it used
 to?


'seq' is not a function, since it breaks referential transparency and
possibly extensionality in function composition.  By construction, seq a b
= b, and yet seq undefined b /= b.  Admittedly, the Haskell report and
the GHC implementation, diverge on this issue.  Haskell98 specifically
defines seq in terms of a comparison with bottom, whereas GHC merely
reduces the first argument to WHNF.  In any case, the reduction is a side
effect, with which can lead to inconsistent semantics if 'seq' is included
in the language.

It is nice to know that we can work in a consistent language if we avoid
certain constructs, such as 'seq', 'unsafePerformIO', and probably others.
 In addition to making the core language conceptually simpler, it means
that we can be sure we aren't inadvertently destroying the correctness
guarantees introduced by the Howard-Curry correspondence theorem.



 Nope, it contains one. Just ask any proof theorist, or anyone who uses
 witnesses to capture information in the type system.


I have studied enough proof theory, model theory, and lattice theory to know
that there is room for both positions.  Just because you /can/ lift a
lattice into one with bottom, it doesn't mean you /should/, if it means
losing conceptual clarity.  In particular, I don't see why you want to
generate an algebra of special cases that add no expressiveness, and include
them in the language, when you can use a quotient construction to remove
them from the language.  As a practical matter, 'seq' is necessary.  But it
should be treated as a special case (like unsafePerformIO), because it IS
one.

Also, there is no need for a set to contain an element for it to be named or
quantified over.  The empty set can be a witness just as well as a singleton
set.  EmptyDataDecls works just as well whether you interpret (undefined ::
Blah) to mean a Blah that is not defined or a Blah that is the value
'undefined'.  Indeed, the latter is paradoxical.  'undefined = undefined'
type checks, but it is not well-founded -- which is exactly why it is not
defined!  'undefined' is not a value.   It is the name for a thing which
cannot be evaluated.  We happen to know that there are a lot of things which
cannot be evaluated, but the quotient construction treats them all the same.
 (There is the practical issue of GHC handling Prelude.undefined differently
than the other bottoms.  But I won't complain about that ;0)


  If you choose to interpret all bottoms as being the same non-existent,
 unquantifiable (in the language of Haskell) proto-value, you get the
 isomorphism between types a and (a), as types.


 Nope, because we have

notBottom :: OneTuple a - Bool
notBottom x = x `seq` True

 whereas

isBottom :: a - Bool
isBottom x = x `seq` True


seq is not a function, and is removed from consideration by the quotient
construction I have mentioned, specifically because of how it behaves on
bottom and the fact that the Haskell98 report defines it in terms of
comparing values to bottom, an operation which is known to be impossible.
 notBottom and isBottom are also not functions, for the same reason.





  Indeed, those are the
 semantics in use by the language.  A value written (a) is interpreted as
 a.
  A type written (a) is interpreted as a.


 That's a syntactic matter. Those are parentheses of grouping, not
 parentheses of tuple construction. For example, you can say:

(,) a b

 or

(,,) a b c

 

Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread Alexander Solla
On Mon, Mar 7, 2011 at 3:38 PM, Alexander Solla alex.so...@gmail.comwrote:



 This can be detected by seq: the left-hand side doesn't terminate, whereas
 the right-hand side does. And moreover, this can mess up other things (e.g.,
 monads) by introducing too much laziness. Space leaks are quite a serious
 matter and they have nothing to do with trying to compare uncomputable
 values. Do you want a seemingly insignificant refactoring to cause your
 program to suddenly hang forever? Or to take up gobs more space than it used
 to?


 'seq' is not a function, since it breaks referential transparency and
 possibly extensionality in function composition.  By construction, seq a b
 = b, and yet seq undefined b /= b.  Admittedly, the Haskell report and
 the GHC implementation, diverge on this issue.  Haskell98 specifically
 defines seq in terms of a comparison with bottom, whereas GHC merely
 reduces the first argument to WHNF.  In any case, the reduction is a side
 effect, with which can lead to inconsistent semantics if 'seq' is included
 in the language.

 It is nice to know that we can work in a consistent language if we avoid
 certain constructs, such as 'seq', 'unsafePerformIO', and probably others.
  In addition to making the core language conceptually simpler, it means
 that we can be sure we aren't inadvertently destroying the correctness
 guarantees introduced by the Howard-Curry correspondence theorem.


As a matter of fact, if you read GHC.Prim, you will see that seq is a
bottom!

seq :: a - b - b
seq = let x = x in x

The magic semantics of evaluating the first argument are done by the
compiler/runtime, and are apparently not expressible in Haskell.  This is
true of
inline
lazy
unsafeCoerce

and dozens of others, all of which are expressed as specialized types with
the same equation:
let x = x in x
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread Daniel Fischer
On Tuesday 08 March 2011 00:58:36, Alexander Solla wrote:
 
 As a matter of fact, if you read GHC.Prim, you will see that seq is a
 bottom!

No, you don't. GHC.Prim is a dummy module whose only purpose is to let 
haddock generate documentation. Every function there has the code
let x = x in x, e.g.

plusWord# :: Word# - Word# - Word#
plusWord# = let x = x in x

minusWord# :: Word# - Word# - Word#
minusWord# = let x = x in x

undefined is not yet available, otherwise probably everything in GHC.Prim 
would be pseudo-defined as undefined for haddock.

 
 seq :: a - b - b
 seq = let x = x in x
 
 The magic semantics of evaluating the first argument are done by the
 compiler/runtime, and are apparently not expressible in Haskell.

Right.
But neither is addition of Word# etc., for the primitives, you have to do 
something special.

 This is true of
 inline
 lazy
 unsafeCoerce
 
 and dozens of others, all of which are expressed as specialized types
 with the same equation:
 let x = x in x

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


[Haskell-cafe] AusHack 2011

2011-03-07 Thread Ivan Lazar Miljenovic
It is time once again to start planning for AusHac (the Hackathon Down Under)!

The current proposed dates are 8-10 July.  This time we're trying to
organise a venue in the Sydney CBD, but if all else fails we'll be at
UNSW again.

So, is anyone vehemently opposed to having AusHac at this time or place?

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread wren ng thornton

On 3/7/11 6:38 PM, Alexander Solla wrote:

'seq' is not a function, since it breaks referential transparency and
possibly extensionality in function composition.  By construction, seq a b
= b, and yet seq undefined b /= b.  Admittedly, the Haskell report and
the GHC implementation, diverge on this issue.  Haskell98 specifically
defines seq in terms of a comparison with bottom, whereas GHC merely
reduces the first argument to WHNF.  In any case, the reduction is a side
effect, with which can lead to inconsistent semantics if 'seq' is included
in the language.

It is nice to know that we can work in a consistent language if we avoid
certain constructs, such as 'seq', 'unsafePerformIO', and probably others.
  In addition to making the core language conceptually simpler, it means
that we can be sure we aren't inadvertently destroying the correctness
guarantees introduced by the Howard-Curry correspondence theorem.


You are free to reason in whichever language you so desire. But that 
does not mean the semantics of the language you desire are the same as 
the semantics of Haskell. Fact of the matter is that Haskell has 'seq' 
and bottom, even if you choose to call them non-functions or non-values.




It is not the case that for every pair, ab, we have that:

ab == (fst ab, snd ab)

Why? Well consider ab = undefined:

_|_ /= (_|_,_|_)



 (undefined, undefined)
(*** Exception: Prelude.undefined

That is as close to Haskell-equality as you can get for a proto-value that
does not have an Eq instance.  As a consequence of referential transparency,
evaluation induces an equivalence relation.  This implies that (_|_, _|_) =
_|_ = (_|_, _|_).

I value referential transparency, and so reject constructs which violate it.


Please demonstrate a proof that _|_ /= (_|_, _|_), so that I can exclude the
unsound constructs you will undoubtedly have to use from my interpretation
of the language.  I am more interested in finding the consistent fragment
of what you call Haskell than defending what I call Haskell.


The trivial proof is:

seq _|_ () == _|_

/=

seq (_|_,_|_) () == ()

But you refuse to believe that 'seq' exists, so here's another proof:

case _|_ of (_,_) - () == _|_

/=

case (_|_,_|_) of (_,_) - () == ()

Do you refuse to believe that case analysis exists too?

--
Live well,
~wren

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread Daniel Fischer
On Tuesday 08 March 2011 00:38:53, Alexander Solla wrote:
 On Sat, Mar 5, 2011 at 5:06 AM, wren ng thornton w...@freegeek.org 
wrote:
  
  If we have,
  
data OneTuple a = One a
  
  Then
  
 _|_ /= One _|_
 
 That is vacuously true.  I will demonstrate the source of the
 contradiction
 
 later.  But you also have _|_ == One _|_, by evaluation:
  Just undefined
 
 Just *** Exception: Prelude.undefined
 

But that shows that _|_ and Just _|_ aren't the same (in Haskell), doesn't 
it?

case x of
Just _ - Just something
Nothing - Nothing

produces Just something for (Just _|_), but not for _|_.

  This can be detected by seq: the left-hand side doesn't terminate,
  whereas the right-hand side does. And moreover, this can mess up
  other things (e.g., monads) by introducing too much laziness. Space
  leaks are quite a serious matter and they have nothing to do with
  trying to compare uncomputable values. Do you want a seemingly
  insignificant refactoring to cause your program to suddenly hang
  forever? Or to take up gobs more space than it used to?
 
 'seq' is not a function, since it breaks referential transparency

Does it, if one assumes that 'seq a b' is *not* the same as 'b' ?

 and
 possibly extensionality in function composition.  By construction, seq
 a b = b, and yet seq undefined b /= b.  Admittedly, the Haskell
 report and the GHC implementation, diverge on this issue.  Haskell98
 specifically defines seq in terms of a comparison with bottom, whereas
 GHC merely reduces the first argument to WHNF.

But reducing to WHNF is precisely what is needed to detect bottom.
If a value is a constructor application or a lambda, it's not bottom.

 In any case, the
 reduction is a side effect, with which can lead to inconsistent
 semantics if 'seq' is included in the language.

But seq is in the language, as specified by the report. You can argue 
that it shouldn't and campaign for its removal, but it's in now and 
speaking about Haskell, one can only sometimes ignore it.


  
  It is not the case that for every pair, ab, we have that:
 ab == (fst ab, snd ab)
  
  Why? Well consider ab = undefined:
 _|_ /= (_|_,_|_)
  
  (undefined, undefined)
 
 (*** Exception: Prelude.undefined
 
 That is as close to Haskell-equality as you can get for a proto-value
 that does not have an Eq instance.  As a consequence of referential
 transparency, evaluation induces an equivalence relation.  This implies
 that (_|_, _|_) = _|_ = (_|_, _|_).

But

case x of
  (_, _) - Okay

distinguishes _|_ and (_|_, _|_). In Haskell98 and Haskell2010, they are 
not the same.

 
 I value referential transparency, and so reject constructs which violate
 it.
 
 
 Please demonstrate a proof that _|_ /= (_|_, _|_), so that I can exclude
 the unsound constructs you will undoubtedly have to use from

Pattern matching

 my interpretation of the language.
 I am more interested in finding the
 consistent fragment of what you call Haskell than defending what I call
 Haskell.

That can be a source of much confusion. Usually, 'Haskell' is understood as 
the language defined in the report. There's some room for interpretation, 
but not too much. If you call soemthing too different 'Haskell', people 
won't understand you. 

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


Re: [Haskell-cafe] Learn You a Haskell for Great Good - a few doubts

2011-03-07 Thread wren ng thornton

On 3/7/11 6:58 PM, Alexander Solla wrote:

The magic semantics of evaluating the first argument are done by the
compiler/runtime, and are apparently not expressible in Haskell.


Of course this is true. The only ways of forcing evaluation in Haskell 
are (a) to perform pattern matches on a value, (b) use 'seq'--- either 
directly or in its disguised forms: strict data constructors and 
-XBangPatterns.


In order to use pattern matching you need to know what the constructors 
of the type are in order to force a choice between different 
constructors; therefore you can't use case analysis to define a function 
with the type and semantics of 'seq'.


But 'seq' is still defined in the Haskell report and therefore a part of 
Haskell. Many have lamented the problems introduced by a parametric 
polymorphic 'seq'; if it were just type-class polymorphic then it 
wouldn't be such a problem. But then a type-class polymorphic 'seq' 
could lead to maintenance issues similar to those faced by Java's 
checked exceptions, which is why it was rejected from Haskell.


--
Live well,
~wren

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


Re: [Haskell-cafe] ANNOUNCE: cinvoke 0.1 released

2011-03-07 Thread Felipe Almeida Lessa
On Mon, Mar 7, 2011 at 6:32 PM, Remi Turk rt...@science.uva.nl wrote:
 - If you need to pass C structs (by value), you'll have to use
  libffi: cinvoke doesn't support them at all.

What about CInvStructure[1]?  I was just glancing at the documentation
when I saw this.

Cheers! =)

[1] 
http://www.nongnu.org/cinvoke/doc/cinvoke_8h.html#b39daa4325b8b87aa246cd8acf8a7e65

-- 
Felipe.

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


Re: [Haskell-cafe] Haskell IDE

2011-03-07 Thread Hamish Mackenzie
Please try the version here https://github.com/jutaro

Hopefully we will be in a position to release a new version very soon.

Hamish

On 8/03/2011, at 5:39, Daniel Fischer daniel.is.fisc...@googlemail.com wrote:

 On Monday 07 March 2011 16:08:01, Alberto G. Corona wrote:
 I use leksah, and I want to say thanks to the people that maintain it. I
 want also to encourage them to continuing its valuable work.
 
 from the last release of Leksah, I particulary appreciate its:
 
 Multiplatform support
 Ease of installation in all platforms including windows
 capability to works with many cabal packages in a single workspace
 its detection of dependencies and rebuilding of the affected packages
 Integration of GHCI and the GHCI debugger
 integrated building of documentation
 referencing and navigation trough the  source of the installed packages
 and of course all the other traditional IDE capabilities
 
 That sounds nice, so I thought I'd try out leksah again.
 
 Unfortunately, the dependencies rule out GHC-7 (base  4.3, Cabal  1.9, 
 containers  0.4 were the ones that sprang to the eyes immediately).
 Bummer
 
 Maybe someone could try relaxing the bounds and build it with GHC-7, and - 
 if it works - upload a new version?
 (I could try if I get a go-ahead from Hamish or Jürgen)
 
 ___
 Leksah mailing list
 lek...@projects.haskell.org
 http://projects.haskell.org/cgi-bin/mailman/listinfo/leksah

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


[Haskell-cafe] have anyone tried GHC 7.0.2

2011-03-07 Thread Qi Qi
Hi,

After I installed GHC 7.0.2 and cabal-install 0.10.0 using Cabal library
1.10.1, I found that some package failed to install. For example like
Happy, I got the following error:

cabal install happy
Resolving dependencies...
command line: cannot satisfy -package Cabal-1.10.1.0: 
Cabal-1.10.1.0-64e8f05722ea5bbdf07df2e5a3491105 is unusable due to missing 
or recursive dependencies:
  directory-1.1.0.0-85d1d0f9d96dffdacf64f3cc6fba6f2f 
process-1.0.1.5-4cab1bf0666275ac101dd48c7565b64c
(use -v for more information)
cabal: Error: some packages failed to install:
happy-1.18.6 failed during the configure step. The exception was:
ExitFailure 1

Besides happy package, some other packages like ghc-mod, hmatrix also
failed to install. Does anyone else have the same issue after installed
ghc 7.0.2? 

By the way, does anyone hear anything about Haskell-platform 2011.2 ?


Thanks!

-- 
Qi Qi

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


[Haskell-cafe] Questions on list administration

2011-03-07 Thread Karthick Gururaj
Hello,

I recently joined Haskell group and wanted to share a few points.

First, I came to Haskell cafe from google groups (groups.google.com -
search for Haskell). Two groups are listed: fa.haskell and
haskell-cafe. I became a member of Haskell Cafe via the google
groups interface (the operation was successful according to google).
When I posted a message, I got an automated email (within a few
seconds, so I think there was no human moderation):

You are not allowed to post to this mailing list, and your message has
been automatically rejected.  If you think that your messages are
being rejected in error, contact the mailing list owner at
haskell-cafe-ow...@haskell.org.

I wrote to the email address mentioned and didn't get any response.
Funny thing is, google reports that my post was successful, and my
post was visible on google groups even after I signed out from my
google account.

I next wrote to the group owner, again from the google groups
interface (there is an option to send email to the owner). No
response here as well.

I then went to Haskell.org - Mailing lists and saw there are atleast
three lists of immediate relevance, including one for beginners. The
website also describes the posting guidelines and other information.
Very useful. I would have stuck to asking questions on the beginner's
group if I had known earlier..

Can I ask a couple of changes be done to help others like me?
a. In google groups -
https://groups.google.com/group/haskell-cafe/about - add a link to
the haskell.org - Mailing lists for more info.
b. Let users join from google groups interface, or if this is not
possible, mention that in the about page
c. Change the contents of the reject email (reproduced above) to
include the following:
If you want to subscribe to the Haskell Cafe mailing list, please
visit http://www.haskell.org/mailman/listinfo/haskell-cafe;

Aside: the Haskell Cafe mailing list page (at
http://www.haskell.org/mailman/listinfo/haskell-cafe) has a dead link
at the bottom of the page. The Overview of all haskell.org mailing
lists points to http://www.haskell.org/cgi-bin/mailman/listinfo (404
error) instead of http://haskell.org/mailman/listinfo.

Thanks!

Warm regards,
Karthick

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


Re: [Haskell-cafe] ANN: theoremquest-0.0.0

2011-03-07 Thread rusi


On Feb 28, 7:59 pm, Tom Hawkins tomahawk...@gmail.com wrote:
 I have been wanting to gain a better understanding of interactive
 theorem proving for some time.  And I've often wondered: Can theorem
 proving be made into a user-friendly game that could attract mass
 appeal?  And if so, could a population of gamers collectively solve
 interesting and relevant mathematical problems?

 To try to answer these questions -- and to gain some experience myself
 with theorem proving -- I started a project called TheoremQuest [1].
 TheoremQuest intends to be a multi-player game system, where the game
 server receives requests by clients, such as theorem queries and
 inference rule applications.  The TheoremQuest server validates
 deductions, compares them with existing theorems in the database, then
 returns results.  TheoremQuest's deductive system borrows that of John
 Harrison's HOL Light [2].

 There are 2 Hackage packages:  theoremquest [3] is a library that
 declares types for terms, inference rules, and client-server
 transactions, used by both server and clients; and theoremquest-client
 [4] is an example client (tq).  All the code, including the
 server-side, is hosted at github [5].

 Currently the client-server interface is working, but little else.
 The library has defined most of the core inference rules, but has none
 of the basic types or axioms.  And the tq client is nothing at all
 like a game; at this point it is just a command line tool to test the
 server.  Currently tq can ping the server, create a new user, apply
 inference rules, and print out theorems.  Here's how tq can prove x
 |- x:

 $ tq newuser tomahawkins tomahawk...@gmail.com
 Ack
 $ export THEOREMQUEST_USER=tomahawkins
 $ tq infer 'ASSUME (Var (Variable x Bool))'
 Id 1
 $ tq theorem 1
 assumptions:
 Var (Variable x Bool)
 conclusion:
 Var (Variable x Bool)

 I'd love to have help with this project, if anyone's interested.

I am curious -- how easy is it to use theoremquest for playing with
equational theories?

In particular equational logic -- see

https://www.ideals.illinois.edu/bitstream/handle/2142/11411/A%20Rewriting%20Decision%20Procedure%20for%20Dijkstra-Scholten%27s%20Syllogistic%20Logic%20with%20Complements.pdf?sequence=2

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