[GHC] #4121: Ghc stage1 panic, ASSERT failure: libraries/base/Control/Applicative.hs

2010-06-07 Thread GHC
#4121: Ghc stage1 panic, ASSERT failure: libraries/base/Control/Applicative.hs
-+--
Reporter:  dterei|   Owner: 
Type:  bug   |  Status:  new
Priority:  normal|   Component:  Compiler   
 Version:  6.12.2|Keywords: 
  Os:  Unknown/Multiple  |Testcase: 
Architecture:  Unknown/Multiple  | Failure:  Building GHC failed
-+--
 While comping GHC Head using the devel1 flavour and ghc-6.12.2 as the
 bootstrap compiler, I get the following assertion failure:

 {{{
 inplace/bin/ghc-stage1   -H64m -O -fasm-package-name base-4.3.0.0
 -hide-all-packages -i -ilibraries/base/. -ilibraries/base/dist-
 install/build -ilibraries/base/dist-install/build/autogen -Ilibraries/base
 /dist-install/build -Ilibraries/base/dist-install/build/autogen
 -Ilibraries/base/include   -optP-DOPTIMISE_INTEGER_GCD_LCM -optP-include
 -optPlibraries/base/dist-install/build/autogen/cabal_macros.h -package
 ghc-prim-0.2.0.0 -package integer-gmp-0.2.0.0 -package rts-1.0  -package-
 name base -XMagicHash -XExistentialQuantification -XRank2Types
 -XScopedTypeVariables -XUnboxedTuples -XForeignFunctionInterface
 -XUnliftedFFITypes -XDeriveDataTypeable -XGeneralizedNewtypeDeriving
 -XFlexibleInstances -XStandaloneDeriving -XPatternGuards -XEmptyDataDecls
 -XNoImplicitPrelude -XCPP -no-user-package-conf -rtsopts -O -dcore-lint
 -fno-warn-deprecated-flags -odir libraries/base/dist-install/build
 -hidir libraries/base/dist-install/build -stubdir libraries/base/dist-
 install/build -hisuf hi -osuf  o -hcsuf hc -c
 libraries/base/./Control/Applicative.hs -o libraries/base/dist-
 install/build/Control/Applicative.o

 WARNING: file compiler/simplCore/CSE.lhs line 349 a_aup
 WARNING: file compiler/simplCore/CSE.lhs line 349 a_aup
 WARNING: file compiler/stgSyn/CoreToStg.lhs line 220
 Control.Applicative.$fAlternativeSTM
 ghc-stage1: panic! (the 'impossible' happened)
   (GHC version 6.13 for i386-unknown-linux):
 ASSERT failed! file compiler/stgSyn/CoreToStg.lhs line 187
 base:Control.Applicative.$fAlternativeSTM{v rk} [gid[DFunId]]
 let {
   sat_s1oj{v} [lid]
 :: forall a{tv 12} [tv].
ghc-prim:GHC.Prim.State#{(w) tc 32q}
  ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}
- (# ghc-prim:GHC.Prim.State#{(w) tc 32q}
ghc-prim:GHC.Prim.RealWorld{(w) tc 31E},
  a{tv 12} [tv] #)
   [LclId]
   sat_s1oj{v} [lid] =
 \ (@ a{tv 12} [tv])
   (eta_B1{v} [lid]
  :: ghc-prim:GHC.Prim.State#{(w) tc 32q}
   ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}) -
   ghc-prim:GHC.Prim.retry#{(w) v 93U} [gid[PrimOp]]
 @ a{tv 12} [tv] eta_B1{v} [lid] } in
 base:Control.Applicative.D:Alternative{v rrp} [gid[DataCon]]
   @ ntbase:GHC.Conc.STM{tc r2r}
   base:Control.Applicative.$fApplicativeSTM{v r2q} [gid[DFunId]]
   (sat_s1oj{v} [lid]
`cast` (forall a{tv aIy} [tv].
ghc-prim:GHC.Prim.sym{(w) tc 34v}
  (base:GHC.Conc.NTCo:STM{tc r2m} a{tv aIy} [tv])
:: (forall a{tv aIy} [tv].
ghc-prim:GHC.Prim.State#{(w) tc 32q}
  ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}
- (# ghc-prim:GHC.Prim.State#{(w) tc 32q}
ghc-prim:GHC.Prim.RealWorld{(w) tc 31E},
  a{tv aIy} [tv] #))
 ~
   (forall a{tv aIy} [tv]. base:GHC.Conc.STM{tc r2r} a{tv aIy}
 [tv])))
   (base:GHC.Conc.orElse1{v re9} [gid]
`cast` (forall a{tv aIx} [tv].
base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
- base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
- ghc-prim:GHC.Prim.sym{(w) tc 34v}
 (base:GHC.Conc.NTCo:STM{tc r2m} a{tv aIx} [tv])
:: (forall a{tv aIx} [tv].
base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
- base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
- ghc-prim:GHC.Prim.State#{(w) tc 32q}
 ghc-prim:GHC.Prim.RealWorld{(w) tc 31E}
- (# ghc-prim:GHC.Prim.State#{(w) tc 32q}
ghc-prim:GHC.Prim.RealWorld{(w) tc 31E},
  a{tv aIx} [tv] #))
 ~
   (forall a{tv aIx} [tv].
base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
- base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv]
- base:GHC.Conc.STM{tc r2r} a{tv aIx} [tv])))
   (base:Control.Applicative.$fAlternativeSTM3{v r2n} [gid]
`cast` (forall a{tv aup} [sk].
base:GHC.Conc.STM{tc r2r} a{tv aup} [sk]
- ghc-prim:GHC.Prim.sym{(w) tc 34v}
 (base:GHC.Conc.NTCo:STM{tc r2m} [a{tv aup} [sk]])
:: (forall a{tv aup} [sk].
base:GHC.Conc.STM{tc r2r} a{tv 

Re: [GHC] #4116: Type supplement for constructor specific uses of sum types

2010-06-07 Thread GHC
#4116: Type supplement for constructor specific uses of sum types
-+--
Reporter:  gabrielrf |   Owner:  
Type:  proposal  |  Status:  new 
Priority:  normal|   Component:  Compiler
 Version:  6.13  |Keywords:  
  Os:  Unknown/Multiple  |Testcase:  
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
-+--

Comment(by gabrielrf):

 Related theoretical article:
 http://winterkoninkje.livejournal.com/56979.html

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4116#comment:3
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] #3961: -O results in incorrect behavior

2010-06-07 Thread GHC
#3961: -O results in incorrect behavior
-+--
Reporter:  RichardG  |Owner:  simonpj
Type:  bug   |   Status:  new
Priority:  high  |Milestone:  6.14.1 
   Component:  Compiler  |  Version:  6.12.1 
Keywords:|   Difficulty: 
  Os:  MacOS X   | Testcase: 
Architecture:  x86   |  Failure:  Incorrect result at runtime
-+--
Changes (by simonmar):

  * milestone:  6.12.3 = 6.14.1


Comment:

 This won't be fixed for 6.12.3, but we almost have a fix ready for HEAD.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3961#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


Re: [GHC] #3822: guards in arrow notation (Arrows extension) case statement cause compiler panic

2010-06-07 Thread GHC
#3822: guards in arrow notation (Arrows extension) case statement cause compiler
panic
-+--
Reporter:  StephenBlackheath |Owner:  ross  
Type:  bug   |   Status:  new   
Priority:  high  |Milestone:  6.12.3
   Component:  Compiler  |  Version:  6.12.1
Keywords:  arrows guards case panic  |   Difficulty:
  Os:  Unknown/Multiple  | Testcase:  patternGuard.hs   
Architecture:  Unknown/Multiple  |  Failure:  Compile-time crash
-+--

Comment(by simonmar):

 Ross: sorry for the delay in getting back to you.  Which bit of code is
 responsible for recognising variables as being used?  Is it arrows-
 specific, or somewhere else?  Can you help us fix it?  (Cheers, Simon 
 Simon)

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3822#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] #3972: ghc 6.12.1 and 6.13.20090922 consume a lot more memory than 6.10.4 when compiling language-python package

2010-06-07 Thread GHC
#3972: ghc 6.12.1 and 6.13.20090922 consume a lot more memory than 6.10.4 when
compiling language-python package
---+
Reporter:  bjpop   |Owner:  simonpj 
  
Type:  bug |   Status:  new 
  
Priority:  high|Milestone:  6.14.1  
  
   Component:  Compiler|  Version:  6.12.1  
  
Keywords:  memory usage|   Difficulty:  
  
  Os:  Linux   | Testcase:  
http://projects.haskell.org/language-python/language-python-0.2.tar.gz
Architecture:  x86_64 (amd64)  |  Failure:  Compile-time performance bug
  
---+
Changes (by simonmar):

  * milestone:  6.12.3 = 6.14.1


Comment:

 Punting to 6.14.1 for a real fix; for 6.12 use one of the workarounds
 (probably the `-fomit-interface-pragmas` one is better).

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3972#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


[GHC] #4120: Iface type variable out of scope in cast

2010-06-07 Thread GHC
#4120: Iface type variable out of scope in cast
-+--
Reporter:  benl  |   Owner: 
Type:  bug   |  Status:  new
Priority:  normal|   Component:  Compiler (Type checker)
 Version:  6.13  |Keywords: 
  Os:  Unknown/Multiple  |Testcase: 
Architecture:  Unknown/Multiple  | Failure:  Runtime performance bug
-+--
 Compiling the following module against vector-0.6 or 0.7:

 {{{
 module Thing where
 import Data.Vector.Unboxed
 import Data.Vector.Unboxed.Mutable  as MV

 thing :: Vector Int
 thing = create (MV.new 5)
 }}}

 Complains about:
 {{{
 desire:tmp benl$ ghc -O -c -fglasgow-exts Thing.hs -fforce-recomp
 /Users/benl/.cabal/lib/vector-0.7/ghc-6.13.20100607/Data/Vector/Unboxed.hi
 Declaration for create
 Unfolding of Data.Vector.Unboxed.create:
   Iface type variable out of scope:  s
 }}}

 Looking in the interface file we have:
 {{{
   create :: forall a.
 Data.Vector.Unboxed.Base.Unbox a =
 (forall s. GHC.ST.ST s (Data.Vector.Unboxed.Base.MVector s a))
 - Data.Vector.Unboxed.Base.Vector a
 {- Arity: 2, Strictness: U(SA)C(U(LL)),
Inline: INLINE (sat-args=0),
Unfolding: InlineRule (1, False, False)
   (\ @ a
  $dUnbox :: Data.Vector.Unboxed.Base.Unbox a
  eta :: forall s.
 GHC.ST.ST
 s
 (Data.Vector.Generic.Base.Mutable
  Data.Vector.Unboxed.Base.Vector s a)
 -
Data.Vector.Generic.new
  @ Data.Vector.Unboxed.Base.Vector
  @ a
  (Data.Vector.Unboxed.Base.$p1Unbox @ a $dUnbox)
  (Data.Vector.Generic.New.New
 @ Data.Vector.Unboxed.Base.Vector
 @ a
 eta))
 `cast`
   (forall a.
Data.Vector.Unboxed.Base.Unbox a =
GHC.ST.ST s
 (Data.Vector.Unboxed.Base.TFCo:R:MutableVector s a)
- Data.Vector.Unboxed.Base.Vector a) -}
 }}}

 The variable `s` in the right of the cast is indeed not in scope.

 This prevents `create` being inlined into client modules, which kills
 performance for benchmarks that create lots of small vectors (like a
 version of quickhull in DPH).

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4120
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] #3984: interpret layout in GHCi

2010-06-07 Thread GHC
#3984: interpret layout in GHCi
--+-
  Reporter:  aavogt   |  Owner:  
  Type:  feature request  | Status:  new 
  Priority:  normal   |  Milestone:  6.14.1  
 Component:  GHCi |Version:  6.12.1  
Resolution:   |   Keywords:  
Difficulty:   | Os:  Unknown/Multiple
  Testcase:   |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown |  
--+-
Changes (by igloo):

  * owner:  igloo =
  * status:  closed = new
  * resolution:  fixed =


Comment:

 We still need to fix the editing, e.g. up should give you the whole
 multi-line input at once, rather than giving it to you line-by-line.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3984#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] #3982: Random instance for Double can generate values out of requested range

2010-06-07 Thread GHC
#3982: Random instance for Double can generate values out of requested range
--+-
  Reporter:  mokus|  Owner:  igloo   
  Type:  bug  | Status:  closed  
  Priority:  normal   |  Milestone:  6.14.1  
 Component:  libraries/random |Version:  6.12.1  
Resolution:  fixed|   Keywords:  
Difficulty:   | Os:  Unknown/Multiple
  Testcase:   |   Architecture:  Unknown/Multiple
   Failure:  Incorrect result at runtime  |  
--+-
Changes (by igloo):

  * status:  patch = closed
  * resolution:  = fixed


Comment:

 Applied, thanks!

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3982#comment:3
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] #3984: interpret layout in GHCi

2010-06-07 Thread GHC
#3984: interpret layout in GHCi
--+-
  Reporter:  aavogt   |  Owner:  igloo   
  Type:  feature request  | Status:  closed  
  Priority:  normal   |  Milestone:  6.14.1  
 Component:  GHCi |Version:  6.12.1  
Resolution:  fixed|   Keywords:  
Difficulty:   | Os:  Unknown/Multiple
  Testcase:   |   Architecture:  Unknown/Multiple
   Failure:  None/Unknown |  
--+-
Changes (by igloo):

  * status:  patch = closed
  * resolution:  = fixed


Comment:

 Applied, thanks!

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3984#comment:7
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] #4115: hsc2hs puts linker flags before object file, causes linker errors

2010-06-07 Thread GHC
#4115: hsc2hs puts linker flags before object file, causes linker errors
-+--
Reporter:  guest |   Owner:
Type:  bug   |  Status:  new   
Priority:  normal|   Component:  hsc2hs
 Version:  6.10.2|Keywords:
  Os:  Unknown/Multiple  |Testcase:
Architecture:  Unknown/Multiple  | Failure:  Other 
-+--

Comment(by duncan):

 Patch needs testing.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4115#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


[GHC] #4119: File buffering isn't flushed at exit

2010-06-07 Thread GHC
#4119: File buffering isn't flushed at exit
---+
Reporter:  EyalLotem   |   Owner: 
Type:  bug |  Status:  new
Priority:  normal  |   Component:  libraries/base 
 Version:  6.12.1  |Keywords:  file buffers   
  Os:  Linux   |Testcase: 
Architecture:  x86_64 (amd64)  | Failure:  Incorrect result at runtime
---+
 In C, there's an atexit handler to fflush all FILE* files.

 In most other environments (e.g: Python files), file buffers are flushed
 in a graceful exit.  With GHC 6.12.1, they aren't.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4119
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] #4106: undefined reference to `__stg_EAGER_BLACKHOLE_INFO'

2010-06-07 Thread GHC
#4106: undefined reference to `__stg_EAGER_BLACKHOLE_INFO'
---+
  Reporter:  Mikolaj   |  Owner:  simonmar
  Type:  bug   | Status:  closed  
  Priority:  normal|  Milestone:  
 Component:  Compiler  |Version:  6.12.1  
Resolution:  fixed |   Keywords:  
Difficulty:| Os:  Linux   
  Testcase:|   Architecture:  powerpc 
   Failure:  Other |  
---+

Comment(by Mikolaj):

 Thank you. The problems with black hole are gone. I've recompiled Debian's
 ghc6_6.12.1-13 after applying your change, and the parallel tests now are:

 {{{
3 total tests, which gave rise to
   19 test cases, of which
0 caused framework failures
   15 were skipped

4 expected passes
0 expected failures
0 unexpected passes
0 unexpected failures
 }}}


 where the skipped tests are unrelated to black hole and probably due to
 the Ghostscript problem, as in the previously attached log.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4106#comment:3
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] #4118: GHC forces gcc version on mingw32

2010-06-07 Thread GHC
#4118: GHC forces gcc version on mingw32
-+--
Reporter:  uzytkownik|   Owner: 
Type:  bug   |  Status:  new
Priority:  normal|   Component:  Compiler   
 Version:  6.12.1|Keywords: 
  Os:  Unknown/Multiple  |Testcase: 
Architecture:  Unknown/Multiple  | Failure:  Building GHC failed
-+--
 GHC forces internal gcc version on mingw32 instead of using system one.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4118
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] #4117: GHC does not accept --srcdir

2010-06-07 Thread GHC
#4117: GHC does not accept --srcdir
-+--
Reporter:  uzytkownik|   Owner: 
Type:  bug   |  Status:  new
Priority:  normal|   Component:  Compiler   
 Version:  6.12.1|Keywords: 
  Os:  Unknown/Multiple  |Testcase: 
Architecture:  Unknown/Multiple  | Failure:  Building GHC failed
-+--
 GHC does not accept --srcdir during building. (Yes - I know of error but
 it should be fixed).

 PS. Priority is probably lower then normal
 PPS. For question why - I try to integrate it with takeoffgw so I try to
 write cygbuild which uses separate build directory.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4117
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] #3947: ghc: panic! (the 'impossible' happened)

2010-06-07 Thread GHC
#3947: ghc: panic! (the 'impossible' happened)
---+
  Reporter:  steenreem |  Owner:  
  Type:  bug   | Status:  closed  
  Priority:  normal|  Milestone:  
 Component:  Compiler  |Version:  6.10.4  
Resolution:  duplicate |   Keywords:  
Difficulty:| Os:  Unknown/Multiple
  Testcase:|   Architecture:  Unknown/Multiple
   Failure:  None/Unknown  |  
---+
Changes (by simonmar):

  * status:  infoneeded = closed
  * version:  6.12.1 = 6.10.4
  * resolution:  = duplicate
  * milestone:  6.12.3 =


Comment:

 Dup of #3435.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3947#comment:3
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] #4116: Type supplement for constructor specific uses of sum types

2010-06-07 Thread GHC
#4116: Type supplement for constructor specific uses of sum types
-+--
Reporter:  gabrielrf |   Owner:  
Type:  proposal  |  Status:  new 
Priority:  normal|   Component:  Compiler
 Version:  6.13  |Keywords:  
  Os:  Unknown/Multiple  |Testcase:  
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
-+--

Comment(by gabrielrf):

 Benefits: Avoid ''error'' calls (runtime), exception control and Maybe
 types
 in partially defined (constructor specific) functions on sum types

 Method: by refining function argument types with a list of constructors
 applyable
 and detecting the target constructor at the caller through pattern
 matching,
 flagging with compiler errors the unmatched cases.


 As an example, with

 {{{
data List a = Nil | Cons a (List a)
 }}}


 * Actual system: undefined cases are discriminated with runtime errors or
 exception throwing or optional Maybe results.

 {{{
hd :: List a - a
hd (Cons x _) - x
hd Nil - error error: hd: empty list -- (as in GHC Data.List head)
 }}}

 * Proposed system: supplement types with
  a suffix ''@Constructor'' or ''@{Constructor1, Constructor2}''

 denoting the list of constructors to which the function can be applied.

 {{{
hd :: List @Cons a - a
hd (Cons x _) = x

-- no definition for unappropriate constructors.
 }}}

 The caller must do pattern matching before applying the constructor-
 specific function.

 In a pattern ''var @ (Constructor {})''
 the compiler should set a ''constructorAt'' property for ''var''
 to the specified pattern constructor
 and when used in a constructor specific parameter position
 match the type supplement constructor list


 using it:

 {{{
accumulateHead :: (a-b) - a - List a - b

accumulateHead f accum list = case list of

 li @ Cons {} - f accum $ hd li  -- constructorAt li == 'Cons'
  -- should pass typechecker at ''hd'' for
 ''List @ Cons''

 li @ Nil  - f accum $ hd li -- compiler error !!
 -- constructorAt li == 'Nil' ; no match

 _ - f accum $ hd list   -- compiler error !!
 -- constructorAt list == Nothing ; no
 match

 _ - accum   -- default option closing pattern matching
 exhaustivity.
 }}}

 (from Jason Dagit contribution)
 
 Syntax {Cons, Cons2} for more than one constructor

 {{{
  data List2 a = Nil | Cons a (List2 a) | Cons2 a a (List2 a)

  hd :: List2 @ {Cons, Cons2} a - a
 }}}

 Discussion thread:

 [http://thread.gmane.org/gmane.comp.lang.haskell.cafe/75586]

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4116#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] #4115: hsc2hs puts linker flags before object file, causes linker errors

2010-06-07 Thread GHC
#4115: hsc2hs puts linker flags before object file, causes linker errors
-+--
Reporter:  guest |Owner:
Type:  bug   |   Status:  patch 
Priority:  normal|Milestone:
   Component:  hsc2hs|  Version:  6.10.2
Keywords:|   Difficulty:
  Os:  Unknown/Multiple  | Testcase:
Architecture:  Unknown/Multiple  |  Failure:  Other 
-+--
Changes (by igloo):

  * status:  new = patch


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4115#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] #2458: Unknown symbol `_environ' on MacOS X

2010-06-07 Thread GHC
#2458: Unknown symbol `_environ' on MacOS X
-+--
  Reporter:  IgorBoehm   |  Owner: 
  Type:  bug | Status:  new
  Priority:  high|  Milestone:  6.14.1 
 Component:  libraries/base  |Version:  6.10.1 
Resolution:  |   Keywords:  environ
Difficulty:  Unknown | Os:  MacOS X
  Testcase:  |   Architecture:  x86
   Failure:  None/Unknown|  
-+--
Changes (by igloo):

  * priority:  normal = high
  * milestone:  6.12.3 = 6.14.1


Comment:

 {{{
 [20:55]  safiire Has anyone here ran into a problem of trying to link a
library compiled with ghc -c into a C++ project and
receiving an unresolved symbol _environ.  I am aware
 that
_environ is supposed to be defined in crt1.o, however
 the
C++ project I am building is an audio unit plugin on
 OSX, so
it never links against crt1.o as it is not an
 executable,
but a shared object itself.  There is something called
 the
osx _environ bug which is the cause of t
 [20:55]  safiire his.  The work around is that OSX applications are not
supposed to call environ(), but are supposed to call
_NSGetEnviron(), or, that is the workaround at least.
HSBase4.2.0.0.a does not do this on OSX apparently.
 Does
anyone know how I can get my linker resolve this
 symbol, or
not care that it is undefined, short of recompling
 haskel
from source and manually patching it to not call
 environ()?
 }}}

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/2458#comment:7
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] #4118: GHC forces gcc version on mingw32

2010-06-07 Thread GHC
#4118: GHC forces gcc version on mingw32
+---
Reporter:  uzytkownik   |  Owner:  
Type:  bug  | Status:  closed  
Priority:  normal   |  Component:  Compiler
 Version:  6.12.1   | Resolution:  wontfix 
Keywords:   | Os:  Unknown/Multiple
Testcase:   |   Architecture:  Unknown/Multiple
 Failure:  Building GHC failed  |  
+---
Changes (by duncan):

  * status:  new = closed
  * resolution:  = wontfix


Comment:

 This is the intended behaviour. We cannot by default rely on an existing
 mingw or cygwin installation. There are sometimes subtle compatibility
 issues.

 Of course if you specifically want to use a different gcc installation
 then that is fine. It is just that ghc should not use a different one
 automatically without the user knowing about it.

 You can override the gcc that ghc uses by using command line flags (see
 the [http://www.haskell.org/ghc/docs/6.12.2/html/users_guide/options-
 phases.html#replacing-phases ghc user guide for details ] and note that
 you will need to specify all of `-pgmc`, `-pgma` and `-pgml`).

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4118#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] #3649: inconsistent exception between unix/windows for running non-existant program

2010-06-07 Thread GHC
#3649: inconsistent exception between unix/windows for running non-existant
program
--+-
Reporter:  duncan |Owner:  
Type:  bug|   Status:  new 
Priority:  normal |Milestone:  6.14.1  
   Component:  libraries/process  |  Version:  6.10.4  
Keywords: |   Difficulty:  
  Os:  Unknown/Multiple   | Testcase:  
Architecture:  Unknown/Multiple   |  Failure:  None/Unknown
--+-

Comment(by duncan):

 Another instance of the same problem is when we do not have permission to
 execute the program (see ticket #4110 where the original example is about
 /tmp being mounted noexec).

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3649#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] #4110: hsc2hs gives bad error message when it cannot execute the generated program

2010-06-07 Thread GHC
#4110: hsc2hs gives bad error message when it cannot execute the generated 
program
-+--
Reporter:  duncan|   Owner:  
Type:  bug   |  Status:  new 
Priority:  normal|   Component:  hsc2hs  
 Version:  6.12.2|Keywords:  
  Os:  Unknown/Multiple  |Testcase:  
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
-+--

Comment(by duncan):

 A fix for #3649 would likely also help this case.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4110#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: ANNOUNCE: MonadCatchIO-foreign

2010-06-07 Thread Simon Marlow

On 03/06/2010 07:29, Evan Laforge wrote:

On Sun, May 30, 2010 at 5:15 PM, Antoine Latteraslat...@gmail.com  wrote:

Hi GHC,

Is there a reason that Foreign.Marshall.Array.allocaArray calls into
allocaBytes instead of allocaBytesAligned? Since alloca needs the
alignment, wouldn't allocaArray also need it?

I'm not too up on how memory access is supposed to work, it was just
something that jump out at me.


I've been waiting for a response on this, because I'm curious too, in
fact I always have been.  At the upgrade to 6.10, ghc suddenly started
using 'alignment' and all my programs which had defined it to
'undefined' since I didn't know what alignment was for and it didn't
seem to be used, started crashing.  So I dug around, dug up the '#let
alignment' macro boilerplate, and copy and pasted it around.

However, at the same time, my program started rarely but consistently
crashing with an assertion failure from the gc runtime.  I'm
suspicious of the inconsistent use of alignment, but it's hard to use
allocaBytesAligned since it's not exported, and the ffi lib is part of
ghc and it's not obvious how to modify it.


Here's the ticket:

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

Lennart's patch added allocaBytesAligned to Foreign.Marshal.Alloc, but 
we'll have to do a library proposal to add that.


If you can reproduce the assertion failure, please submit a bug report.

Cheers,
Simon

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


[Haskell] Re: [Haskell-cafe] Please check your dependencies on fgl

2010-06-07 Thread Don Stewart
ivan.miljenovic:
 Thomas Bereknyei are currently re-writing fgl (just about completely
 from scratch) and we plan to make an initial release to get feedback
 on the API in the next few weeks.
 
 However, I'm sending this email out now to warn people that I highly
 doubt any code that was written for the current version of fgl
 (http://hackage.haskell.org/package/fgl-5.4.2.2) will work with the
 new version.

How about you give the library a different name then -- so as not to
break all those programs?

A complete rewrite with a new maintainer: fgl-awesome

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


[Haskell] Workshop on Generic Programming (WGP) 2010 Final Call for papers!

2010-06-07 Thread Bruno Oliveira

Dear all,

This a final reminder that the deadline for WGP submissions is in one  
week! See the call for papers below:


==
   CALL FOR PAPERS
   WGP 2010

   6th ACM SIGPLAN Workshop on Generic Programming
   Baltimore, Maryland, US
 Sunday, September 26th, 2010

  http://osl.iu.edu/wgp2010

Collocated with the International Conference on Functional Programming
 (ICFP 2010)
==

Goals of the workshop
-

Generic programming is about making programs more adaptable by making
them more general. Generic programs often embody non-traditional kinds
of polymorphism; ordinary programs are obtained from them by suitably
instantiating their parameters. In contrast with normal programs, the
parameters of a generic program are often quite rich in structure; for
example they may be other programs, types or type constructors, class
hierarchies, or even programming paradigms.

Generic programming techniques have always been of interest, both to
practitioners and to theoreticians, and, for at least 20 years,
generic programming techniques have been a specific focus of research
in the functional and object-oriented programming communities. Generic
programming has gradually spread to more and more mainstream
languages, and today is widely used in industry. This workshop brings
together leading researchers and practitioners in generic programming
from around the world, and features papers capturing the state of the
art in this important area.

We welcome contributions on all aspects, theoretical as well as
practical, of

 * polytypic programming,
 * programming with dependent types,
 * programming with type classes,
 * programming with (C++) concepts,
 * generic programming,
 * programming with modules,
 * meta-programming,
 * adaptive object-oriented programming,
 * component-based programming,
 * strategic programming,
 * aspect-oriented programming,
 * family polymorphism,
 * object-oriented generic programming,
 * and so on.

Organizers
--

Co-Chair
   Bruno C. d. S. Oliveira, Seoul National University
Co-Chair
   Marcin Zalewski, Indiana University

Programme Committee
---

Alley Stoughton, Kansas State University
Andrei Alexandrescu, Facebook
Bruno C. d. S. Oliveira (Co-Chair), Seoul National University
Doug Gregor, Apple
Gilad Bracha, I am a Computational Theologist Emeritus
Magne Haveraaen, Universitetet i Bergen
Marcin Zalewski (Co-Chair), Indiana University
Neil Mitchell, Standard Chartered
Ralf Lämmel, University of Koblenz-Landau
Shin-Cheng Mu, Academia Sinica
Thorsten Altenkirch, University of Nottingham
Ulf Norell, Chalmers University

Important Information
-

We plan to have formal proceedings, published by the ACM.

Submission details
Deadline for submission: Sunday2010-06-13
Notification of acceptance:  Monday2010-07-12
Final submission due:  Tuesday   2010-07-27
Workshop:Sunday2010-09-26

Authors should submit papers, in postscript or PDF format, formatted
for A4 paper, to the WGP09 EasyChair instance by 13th of June
2010. The length should be restricted to 12 pages in standard
(two-column, 9pt) ACM format. Accepted papers are published by the ACM
and will additionally appear in the ACM digital library.

History of the Workshop on Generic Programming
--

This year:

   * Baltimore, Maryland, US 2010 (affiliated with ICFP10)

Earlier Workshops on Generic Programming have been held in

   * Edinburgh, UK 2009 (affiliated with ICFP09)
   * Victoria, BC, Canada 2008 (affiliated with ICFP),
   * Portland 2006 (affiliated with ICFP),
   * Ponte de Lima 2000 (affiliated with MPC),
   * Marstrand 1998 (affiliated with MPC).

Furthermore, there were a few informal workshops

   * Utrecht 2005 (informal workshop),
   * Dagstuhl 2002 (IFIP WG2.1 Working Conference),
   * Nottingham 2001 (informal workshop),

There were also (closely related) DGP workshops in Oxford (June
3-4 2004), and a Spring School on DGP in Nottingham (April 24-27
2006, which had a half-day workshop attached).
Additional information:

The WGP steering committee consists of J Gibbons, R Hinze, P Jansson,
J Jarvi, J Jeuring, B Oliveira, S Schupp and M Zalewski___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] VSTTE 2010: 2nd Call for Poster Session Submissions

2010-06-07 Thread Gudmund Grov
*** Apologies for multiple copies ***



*** Call for POSTERS *** 

3rd International Conference on Verified Software: Theories, Tools, and 
Experiments (VSTTE 2010)
Edinburgh, Scotland

August 16th-19th, 2010

http://www.macs.hw.ac.uk/vstte10

POSTER SESSION

The complementary themes of Theories, Tools and Experiments makes VSTTE 
an unique conference. Through the introduction of a POSTER session 
at VSTTE 2010, we are aiming to widen the body of researchers that are 
involved in the Verified Software Initiative (VSI) and its related
Challenges (more details on VSTTE  VSI are provided below). 

Limited financial support will be available if necessary to enable 
attendance of both MSc and PhD students whose posters are accepted. 
Specifically, we aim to attract students who are already engaged in 
theories or tools or experiments relevant to verification; and give 
them an opportunity to meet other students and researchers engaged 
in complementary experiments or theories or tools. Note that the
POSTER session is open to all researchers, not just students. 
With regards to submissions, we require the following:

1. 1-page abstract of your research
2. Poster OR a poster plan 
3. For students, a supporting statement from your supervisor 

Submissions should be sent electronically to vstt...@macs.hw.ac.uk.

The timetable for POSTER authors is as follows:

JUNE 18:  Submission of abstract  poster (plan) deadline
JUNE 30:  Notification of decision
JULY 31:  Camera-ready abstract deadline 
AUGUST 17:  Poster session

Note that a collection of abstracts for the accepted posters 
will be distributed at the conference. Poster authors will 
be expected to bring their poster with them to the conference.
Details of the size of the final posters will be provided in
due course. 

Financial support will be allocated on a case-by-case basis,
and will support around 30 partial/fully funded places, 
including 10 SICSA PhD funded places.

If you have any queries, please direct them to vstt...@macs.hw.ac.uk 

MORE DETAILS ON VSTTE 2010

SPONSORS

National Science Foundation (NSF)
Engineering and Physical Sciences Research Council (EPSRC)
Microsoft Research
Scottish Informatics  Computer Science Alliance (SICSA)
Altran Praxis
Software Systems Engineering Initiative (SSEI)
Formal Methods Europe (FME)

WHAT IS THE HISTORY OF VSTTE?

The Third International Conference on Verified Software: Theories,
Tools, and Experiments follows a successful inaugural working
conference at Zurich (2005) and a successful conference in Toronto
(2008). This conference is part of the Verified Software Initiative
(VSI), a fifteen-year, cooperative, international project directed
at the scientific challenges of large-scale software verification.
VSI also includes UKCRC's Grand Challenge 6, i.e. Dependable Systems
Evolution. VSTTE is open to anyone who is interested in participating
actively in the VSI effort.

SCOPE

The goal of this conference is to advance the state of the art in
the science and technology of software verification through the
interaction of theory development, tool evolution, and experimental
validation.  Authors are encouraged to submit work in progress,
particularly if the work involves collaboration, theory unification,
and tool integration.  Topics of interest include

requirements modeling
specification languages
specification/verification case-studies
formal calculi
programming languages
language semantics
software design methods
software testing
automatic code generation
refinement methodologies
type systems
computer security
verification tools (static analysis, dynamic analysis, model
checking, theorem proving, satisfiability)
tool integration
benchmarks
challenge problems
integrated verification environments

We also encourage researchers to submit challenges in theory,
formalization, systems verification, code verification, and
applications. Contributions relating to existing challenges
will also be welcomed, i.e.

* POPLMark (http://tinyurl.com/poplmark)
* Tokeneer (http://www.adacore.com/home/products/sparkpro/tokeneer)
* POSIX file system (http://tinyurl.com/qyzqk9)
* medical devices (http://tinyurl.com/pnztqb)

VENUE

VSTTE 2010 is being hosted by Heriot-Watt University in Edinburgh.
The conference dates coincide with the 2010 Edinburgh International
Festival and the Edinburgh Festival Fringe -- collectively the
largest annual  arts festival on the planet! The technical programme
will take place in the Edinburgh Conference Centre (Riccarton campus),
where accommodation will be available at very competitive rates for
festival time. Social events will be arranged within the city centre,
making VSTTE an unique cultural and scholarly event for 2010!

INVITED SPEAKERS

* Tom Ball (Microsoft Research, Redmond)
* Gerwin Klein (National ICT Australia)
* Matthew Parkinson (University of Cambridge)

WORKSHOPS

In addition to the main conference, VSTTE will host two workshops on August 
19th:


[Haskell] Please check your dependencies on fgl

2010-06-07 Thread Ivan Miljenovic
Thomas Bereknyei are currently re-writing fgl (just about completely
from scratch) and we plan to make an initial release to get feedback
on the API in the next few weeks.

However, I'm sending this email out now to warn people that I highly
doubt any code that was written for the current version of fgl
(http://hackage.haskell.org/package/fgl-5.4.2.2) will work with the
new version.

As such, if your code uses fgl you should ensure that the
specification of the package in your .cabal file has an explicit upper
bound (or indeed just set fgl == 5.4.2.2) to avoid any problems when
we release 6.0.0.0 (we're trying to avoid the problems that plagued
KDE-4 by not claiming in the slightest that the initial few versions
are intended for end users).

I have already directly emailed the maintainers of any and all
packages I could find on Hackage (using Roel van Dijk's wonderful
reverse-dependency mirror at
http://bifunctor.homelinux.net/~roel/hackage/packages/hackage.html),
but just in case I've missed one or there's an as-yet-unreleased
package somewhere in the works, here is the official heads up.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell] Re: [Haskell-cafe] Please check your dependencies on fgl

2010-06-07 Thread Ivan Lazar Miljenovic
Oh, great, the email _did_ go out on the mailing lists (what with
haskell.org being down I wasn't sure it would).

Don Stewart d...@galois.com writes:

 ivan.miljenovic:
 Thomas Bereknyei are currently re-writing fgl (just about completely
 from scratch) and we plan to make an initial release to get feedback
 on the API in the next few weeks.
 
 However, I'm sending this email out now to warn people that I highly
 doubt any code that was written for the current version of fgl
 (http://hackage.haskell.org/package/fgl-5.4.2.2) will work with the
 new version.

 How about you give the library a different name then -- so as not to
 break all those programs?

 A complete rewrite with a new maintainer: fgl-awesome

We considered giving it a new name (fgl', etc.) but figured that in the
long term this wouldn't be advantagous.  We feel that the situation is
analogous to QuickCheck: when the new version came out most people kept
using the old one until slowly the momentum shifted and more people
started using the new version (without checking in depth, Roel's Hackage
mirror reports QC-2.x now has 153 reverse dependencies as opposed to 127
reverse dependencies for QC-1.y).

If we changed the name, then the emotional attachment that the Haskell
community has to FGL being the de-facto graph library means that people
would keep using the old version.  Whilst we also face the possible
problems of people not liking the old version and thus automatically
dismissing the new version, I think this is a much more unlikely
scenario.

The overall philosophy is remaining the same: we're just updating the
implementation (letting people pick the Node type rather than
hard-coding it to Int, letting people constrain the label types and also
providing more scope for optimisations).  As such, the new version is
incompatible with the old one; however, if you're only _using_ FGL (as
opposed to making a new instance of the graph types), then the actual
changes to using the new version should be minimal (especially if you're
using it internally in which case you can hard-code the various types in
and not have to worry about the type family usage at all).

As I said, I've directly emailed the maintainers of the packages that
have open-ended dependencies on FGL and thus would have compilation
problems when we release the new version[s]; 7 out of 12 of those
maintainers have already responded within less than 24 hours so I don't
think this is likely to be a problem unless some new package is uploaded
in the near future without proper ranged dependencies.

So as to give you even more of a heads up, here are some more overall
plans Thomas and I have for FGL:

* FGL will still focus on inductive graphs; however the two current
  classes are being combined since it doesn't make much sense in general
  to have a graph that can be decomposed using match but can't be
  composed using  (there might be specific cases where this is true
  such as considering the Cabal package dependency graph; however this
  is likely to be defined internally within some project so users should
  just be careful about how they use it to ensure they don't add
  arbitrary nodes/edges that don't make sense; note that the new Show
  and Read instances take advantage of this by using Contexts as the
  basis of this instance).

* The ability to have proper Eq, Show and Read instances for graphs with
  pre-defined helper functions implementors can use (currently
  Data.Graph.Inductive.Tree has a pretty output for Show but no Read
  instance, and graphs cannot have equality due to overlapping instance
  problems).

* Splitting the library up into the base classes + sample instances (the
  fgl package) and a separate fgl-algorithms package (analogous to Dan
  Doel's vector-algorithms; this will be comprised of what is currently
  in the Data.Graph.Inductive.Query.* modules as well as the
  Data.Graph.Analysis.Algorithms.* modules in my Graphalyze library.
  The Data.Graph.Inductive.Graphviz module will also be scrapped in
  favour of my graphviz library.

* By default, fgl will ship with two default instances: the one
  currently in Data.Graph.Inductive.PatriciaTree and also a generic
  Map-based one that lets people choose their own Node type (i.e. the
  key type in the Map).  Any other suitable instances that we can think
  of (e.g. Thomas has the beginnings of a vector-based one) we'll ship
  in separate packages (e.g. fgl-vector).

If anyone has a good reason to object to any of these plans, we are
willing to be persuaded out of them.  This is why the 6.z series of fgl
will be technology previews to slowly build up what FGL does and gauge
the reaction of the Haskell community.

-- 
Ivan Lazar Miljenovic
ivan.miljeno...@gmail.com
IvanMiljenovic.wordpress.com
___
Haskell mailing list
Haskell@haskell.org
http://www.haskell.org/mailman/listinfo/haskell


[Haskell-cafe] Span function

2010-06-07 Thread R J

Can someone provide a hand calculation of:
span ( 0) [-1, -2, -3, 0, 1, 2, -3, -4, -5]?
I know the result is ([-1, -2, -3], [0, 1, 2, -3, -4, -5]), but the recursion 
flummoxes me.
Here's the Prelude definition:
mySpan :: (a - Bool) - [a] - ([a], [a])mySpan _ 
[]=  ([], [])mySpan p xs@(x:xs')| p x   
   =  (x:ys, zs)| otherwise=  ([], xs)  
 where   (ys, zs) = mySpan p xs'
Thanks.
  
_
Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_1___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Removing alternate items from a list

2010-06-07 Thread R J

What's the cleanest definition for a function f :: [a] - [a] that takes a list 
and returns the same list, with alternate items removed?  e.g., f [0, 1, 2, 3, 
4, 5] = [1,3,5]?
  
_
The New Busy is not the old busy. Search, chat and e-mail from your inbox.
http://www.windowslive.com/campaign/thenewbusy?ocid=PID28326::T:WLMTAGL:ON:WL:en-US:WM_HMP:042010_3___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Stone age programming for space age hardware?

2010-06-07 Thread Michael Schuerig

A few days ago, I watched a presentation by Gerard Holzmann on the 
development methodology and programming techniques used at JPL for 
writing the software for the next Mars mission. I found the talk 
entertaining and learned a few things.

  http://www.infoq.com/presentations/Scrub-Spin

Among the arsenal of methods they use to ensure correctness is model 
checking for the algorithms used as well as rather restrictive coding 
standards. Well, model checking sounds good, real formal oomph. But the 
coding itself? For one thing, they're using C. On top of that, the 
coding standards prohibit dynamic memory allocation, recursion, and 
loops without explicit bounds; see [*] for more details.

I was dumbfounded, although I have known all this. I have no personal 
experience with either embedded or real time software, but I've been 
aware that C still is the most popular language for that purpose and 
that coding standards are very restrictive.

The real reason behind my surprise was, that I was wondering how more 
modern languages could make inroads into such an environment. Haskell 
without recursion and dynamic memory allocation? Hard to imagine.

I have a hunch that the real restrictions of this kind of software are 
not concerned with fixed memory, iterations, whatever, but rather with 
guaranteed bounds. If that is indeed the case, how feasible would it be 
to prove relevant properties for systems programmed in Haskell?

Michael


[*] http://spinroot.com/gerard/pdf/Power_of_Ten.pdf
-- 
Michael Schuerig
mailto:mich...@schuerig.de
http://www.schuerig.de/michael/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: Problems with Haskell Platform

2010-06-07 Thread Brandon S. Allbery KF8NH

On Jun 4, 2010, at 23:04 , Don Stewart wrote:

Build/does not build? That can be automated.



Automated converters have a certain tendency to become confused and  
put files in unexpected places, etc.  Usually this has less to do with  
the source than the destination; in particular, RPM sometimes makes  
some poor assumptions.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Reporting a problem with binary-0.5

2010-06-07 Thread Ketil Malde
Alexey Khudyakov alexey.sklad...@gmail.com writes:

 This issue was discussed on the list before. Get monad definition
 was changed in binary 0.5.0.2. It was made strict and evaluation
 of result of runGet is forced. This increased performance but
 broke programs which relies on lazyness to work.

I just found a more detailed writeup by dons on
http://donsbot.wordpress.com/2009/09/16/data-binary-performance-improvments-for-haskell-binary-parsing/

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to Show an Operation?

2010-06-07 Thread Martin Drautzburg
On Friday, 4. June 2010 18:02:15 Daniel Fischer wrote:
 On Friday 04 June 2010 17:37:16, Martin Drautzburg wrote:
  Dear all,
 
  If I have a problem where I have to select from a set of operations, how
  would I print the result?
 
  Example: If I can chose from (x+y), (x*y), (x^2+y)...
  and I feed them all into my problem solver
  and it finds that (x*y) is right, how can I print that string?

 You'd have to pass the description string to the problem solver too.
 If it was previously

 solver :: Num a = Whatever - [a - a - a] - Result

 it would become for example

 solver :: Num a = Whatever - [(a - a - a, String)] - Result

Thanks to Ozgur Akgun for his suggestion. However I really wanted a human 
readable name, but admittedly I haven't said so.

About this one:

The only thing I miss in this solution, is that the name is identified by its 
position in the Pair. In this case this is certainly not a problem. But 
anyways, I tried to give it a name, using record syntax. 

This worked well until I wanted to define a different set of operations, which 
should also be named. It turned out that the name function, which was 
implicitly created (using record syntax) cannot be used again.

How should I work around that. I could use two different name function, but 
I don't like this. Would I have to define a typeclass namedFunction which 
all have a name function? 

I guess my mind is still a bit stuck in the OO world.

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


RE: [Haskell-cafe] GHC Api typechecking

2010-06-07 Thread Phyx
Hi, Just thought I'd follow up,

I implemented a VirtualFile target in the current head version of ghc just
to test, unfortunately unless I did something wrong It's not really that
much faster.
Most likely because in the scenario I'm using it in, the file would still be
in the disk cache, so I'd mostly get 100% cache hits and as it turns out,
the String approach is only about ~30ms faster than the File Based one.

Even worse when I put the disk under heavy load to get more cache misses,
the difference shrunk to ~22ms because Windows started doing more Fast Reads
and Writes. So while this might be useful for other means, It's not really
that much better in terms of performance.

Regards,
Phyx

-Original Message-
From: Thomas Schilling [mailto:nomin...@googlemail.com] 
Sent: Sunday, April 18, 2010 18:21
To: Phyx
Cc: Gwern Branwen; haskell-cafe@haskell.org
Subject: Re: [Haskell-cafe] GHC Api typechecking

Looking at the code for GHC, it turns out that your use case is not
supported.  It is not allowed to have in-memory-only files.  If you specify
a buffer it will still try to find the module file on the disk, but it will
(or at least should) use the contents from the specified string buffer.

I've been thinking about changing the Finder (the part that maps module
names to source files and .hi files) to use a notion of a virtual file.
This way, the API client could define how and where data is stored.

On 18 April 2010 11:01, Phyx loneti...@gmail.com wrote:
 Hi,

 I checked out how Hint is doing it, but unfortunately they're calling 
 a function in the GHC api's interactive part to typecheck a single
statement, much like :t in ghci, So I can't use it to typecheck whole
modules.
 I've tried working around not being able to construct a TargetId but ran
into another wall.
 I can't find anyway to do dependency analysis on the in-memory target, so
the dependency graph would be empty which is ofcourse a big problem.

 Does anyone know if Leksah uses the GHC api for typechecking? And if it
only gives type errors after you save a file?

 The code I've been trying is

 typeCheckStringOnly :: String - IO (ApiResults Bool) 
 typeCheckStringOnly contents = handleSourceError processErrors $
  runGhc (Just libdir) $ do
    buffer - liftIO $ stringToStringBuffer contents
    clock  - liftIO getClockTime
    dflags - getSessionDynFlags
    setSessionDynFlags dflags
    let srcLoc   = mkSrcLoc (mkFastString internal:string) 1 1
        dynFlag  = defaultDynFlags
        state    = mkPState buffer srcLoc dynFlag
        parsed   = unP Parser.parseModule state
        pkgId    = stringToPackageId internal
        name     = mkModuleName Unknown
        mod'     = mkModule pkgId name
        location = ModLocation Nothing  
        summary  = ModSummary mod' HsSrcFile location clock Nothing [] 
 []  dynFlag Nothing
    (\a-setSession $ a { hsc_mod_graph = [summary] }) = getSession
    case parsed of
       PFailed _ _        - return $ ApiOk False
       POk newstate mdata - do let module' = ParsedModule summary 
 mdata
                                check - typecheckModule module'
                                return $ ApiOk True

 this fails with a ghc panic

 : panic! (the 'impossible' happened)
  (GHC version 6.12.1 for i386-unknown-mingw32):
        no package state yet: call GHC.setSessionDynFlags

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

 :(

 Cheers,
 Phyx

 -Original Message-
 From: Gwern Branwen [mailto:gwe...@gmail.com]
 Sent: Saturday, April 17, 2010 20:59
 To: Phyx
 Subject: Re: [Haskell-cafe] GHC Api typechecking

 On Sat, Apr 17, 2010 at 1:49 PM, Phyx loneti...@gmail.com wrote:
 Hi all, I was wondering if someone knows how to do the following:



 I’m looking to typecheck a string using the GHC Api, where I run into 
 problems is that I need to construct a Target, but the TargetId only 
 seem to reference physical files.



 Ofcourse I can write the string to a file and typecheck that file, 
 but I would like to do it all in memory and avoid IO if possible.



 Does anyone know if this is possible?



 For the record I’m trying to create the target as follows



 createTarget :: String - IO Target

 createTarget content =

  do clock  - getClockTime

     buffer - stringToStringBuffer content

     return $ Target { targetId           = TargetModule (mkModuleName
 string:internal) ß problem

                     , targetAllowObjCode = True

                     , targetContents     = Just (buffer,clock)

                     }



 typeCheckStringOnly :: String - IO (ApiResults Bool)

 typeCheckStringOnly contents = handleSourceError processErrors $

 runGhc (Just libdir) $ do

     dflags - getSessionDynFlags

     setSessionDynFlags dflags

     target - liftIO $ createTarget contents

     addTarget target

     load LoadAllTargets

     let modName = mkModuleName string:internal ß problem again, 
 don’t know how to create the dependency graph then.

     

Re: [Haskell-cafe] Issue with connectTo function in network package

2010-06-07 Thread Jeremy Shaw
Perhaps it was only listening on IPv6 ? ::1 ?

- jeremy

On Thu, Jun 3, 2010 at 10:30 PM, aditya siram aditya.si...@gmail.comwrote:

 Hi all,
 I had an issue where using the connectTo [1] function would fail to
 connect to localhost if my wireless card was turned off. The moment
 I turned on my wireless connection it worked. But if I use connectTo
 with 127.0.0.1 [2] with my network off it works.

 I confirmed that localhost' resolves to 127.0.0.1 by pinging
 localhost from command line with the Internet off.

 Is this a bug in connectTo?

 -deech

 [1] connectTo localhost (PortNumber some_number)
 [2] connectTo 127.0.0.1 (PortNumber some_number)
 ___
 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] Issue with connectTo function in network package

2010-06-07 Thread aditya siram
Great! If there is a wiki or FAQ page for networking with Haskell it
might be worth updating.
-deech

On 6/4/10, Roman Cheplyaka r...@ro-che.info wrote:
 /etc/hosts is the file responsible for resolving 'localhost' hostname.
 As you can see from it, there are two entries for localhost: one
 contains IPv4 address (127.0.0.1) and another contains IPv6 address
 (::1).

 The behaviour you observe is kinda bug in connectTo function. Instead of
 trying all of the addresses, this function just tries the first one.
 Until it is fixed (I'm gonna write and send a patch soon), can you live
 with this temporary hack? If for some reason the answer is no, you
 have to use low-level functions from Network.Socket module for now.


 * aditya siram aditya.si...@gmail.com [2010-06-04 14:15:47-0500]
 Doing (1) solves my problem. What did I do and why did it work? Thanks
 a lot for your help!
 -deech

 On 6/4/10, Roman Cheplyaka r...@ro-che.info wrote:
  Confirm if any of the following solves the problem:
 
  1. commenting out (by prepending putting hash sign '#' in the beginning
 of the line) the following line in /etc/hosts:
 
  ::1 localhost ip6-localhost ip6-loopback
 
  2. executing as root the following command:
 
  rmmod ipv6
 
  * aditya siram aditya.si...@gmail.com [2010-06-04 13:51:29-0500]
  Here's my GHCI session (with my network card off):
  Prelude Network Network.Socket connectTo localhost (PortNumber 3000)
  *** Exception: connect: does not exist (Connection refused)
  Prelude Network Network.Socket connectTo 127.0.0.1 (PortNumber 3000)
  {handle: socket: 7}
 
  The OS is Ubuntu (Lucid) Linux. The contents of /etc/hosts and
  /etc/nsswitch.conf are:
 
   cat /etc/nsswitch.conf
  # /etc/nsswitch.conf
  #
  # Example configuration of GNU Name Service Switch functionality.
  # If you have the `glibc-doc-reference' and `info' packages installed,
  try:
  # `info libc Name Service Switch' for information about this file.
 
  passwd: compat
  group:  compat
  shadow: compat
 
  hosts:  files mdns4_minimal [NOTFOUND=return] dns mdns4
  networks:   files
 
  protocols:  db files
  services:   db files
  ethers: db files
  rpc:db files
 
  netgroup:   nis
 
   cat /etc/hosts
  127.0.0.1   localhost
  127.0.1.1   deech-mac-ubuntu
 
  # The following lines are desirable for IPv6 capable hosts
  ::1 localhost ip6-localhost ip6-loopback
  fe00::0 ip6-localnet
  ff00::0 ip6-mcastprefix
  ff02::1 ip6-allnodes
  ff02::2 ip6-allrouters
  ff02::3 ip6-allhosts
 
 
  -deech
 
  On 6/4/10, Roman Cheplyaka r...@ro-che.info wrote:
   * aditya siram aditya.si...@gmail.com [2010-06-03 22:30:33-0500]
   Hi all,
   I had an issue where using the connectTo [1] function would fail to
   connect to localhost if my wireless card was turned off. The
   moment
   I turned on my wireless connection it worked. But if I use connectTo
   with 127.0.0.1 [2] with my network off it works.
  
   I confirmed that localhost' resolves to 127.0.0.1 by pinging
   localhost from command line with the Internet off.
  
   Is this a bug in connectTo?
  
   -deech
  
   [1] connectTo localhost (PortNumber some_number)
   [2] connectTo 127.0.0.1 (PortNumber some_number)
  
   How exactly did it fail? Did it throw an exception? If so, what was
   the
   exception?
  
   Which operating system did you observe that under?
  
   If that was Linux, can you show the contents of the following files
   on
   that system:
  
   /etc/nsswitch.conf
   /etc/hosts
  
   --
   Roman I. Cheplyaka :: http://ro-che.info/
   Don't let school get in the way of your education. - Mark Twain
   ___
   Haskell-Cafe mailing list
   Haskell-Cafe@haskell.org
   http://www.haskell.org/mailman/listinfo/haskell-cafe
  
 
  --
  Roman I. Cheplyaka :: http://ro-che.info/
  Don't let school get in the way of your education. - Mark Twain
 

 --
 Roman I. Cheplyaka :: http://ro-che.info/
 Don't let school get in the way of your education. - Mark Twain

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


Re: [Haskell-cafe] Function to find a substring

2010-06-07 Thread Thomas Hartman
If you want to use libs to make your life easier, maybe something
along these lines?

Prelude Data.List.Split Safe fmap length . headMay . split (onSublist
asdf) $ blee blah asdf bloo
Just 10

If they are big strings, it's probably faster to use bytestrings, or
arrays of some kinds, rather than default List implementation of
string.

2010/6/6 R J rj248...@hotmail.com:
 What's an elegant definition of a Haskell function that takes two strings
 and returns Nothing in case the first string isn't a substring of the
 first, or Just i, where i is the index number of the position within the
 first string where the second string begins?

 
 Hotmail has tools for the New Busy. Search, chat and e-mail from your inbox.
 Learn more.
 ___
 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] Re: Problems with Haskell Platform

2010-06-07 Thread Don Stewart
allbery:
 On Jun 4, 2010, at 23:04 , Don Stewart wrote:
 Build/does not build? That can be automated.


 Automated converters have a certain tendency to become confused and put 
 files in unexpected places, etc.  Usually this has less to do with the 
 source than the destination; in particular, RPM sometimes makes some poor 
 assumptions.

 -- 

Sounds like a problem with the converters. cabal2arch does no such thing.
But we tightly control the environment.

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


Re: [Haskell-cafe] Re: Problems with Haskell Platform

2010-06-07 Thread Don Stewart
allbery:
 On Jun 4, 2010, at 06:54 , Ivan Lazar Miljenovic wrote:
 Don Stewart d...@galois.com writes:
 However, we have tools for some distros that do this, and some distro
 tools support it directly (e.g. bauerbill --hackage on Arch Linux
 knows how to ask cabal2arch to translate the .cabal file).

 Contribut to yum to allow pulling from hackage, by calling cabal2yum?

 I don't know how it is in Arch, but for Gentoo we need to do a lot of
 QA'ing to make sure our ebuilds generated with hackport work properly
 (which is one reason why we don't churn ebuilds out as fast as you
 generate PKBUILDs).  Part of the problem is probably that hackport  
 isn't
 as polished as cabal2arch, but a few other concerns we need to take  
 care
 of are:


 I don't think anyone just does a conversion and bodges it into the  
 package system, regardless of distribution, package system, or  
 conversion tool.  (Or language; you don't do it with gems, eggs, or CPAN 
 packages either.)  The tool does the boring part of the job for you, but 
 of course you want to edit metadata, test, etc. before setting it loose.  
 Release engineering is not optional.


Build/does not build? That can be automated.

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


Re: [Haskell-cafe] Re: Problems with Haskell Platform

2010-06-07 Thread Don Stewart
ivan.miljenovic:
 Don Stewart d...@galois.com writes:
 
  allbery:
  Supposedly a future Cabal extension will be to, instead of installing,  
  write out a package for a vendor packaging system (yum, apt, yast, what 
  have you).  Consider contributing to that effort.
 
 
  However, we have tools for some distros that do this, and some distro
  tools support it directly (e.g. bauerbill --hackage on Arch Linux
  knows how to ask cabal2arch to translate the .cabal file).
 
  Contribut to yum to allow pulling from hackage, by calling cabal2yum?
 
 In general, I think this is a bad idea.
 
 I don't know how it is in Arch, but for Gentoo we need to do a lot of
 QA'ing to make sure our ebuilds generated with hackport work properly

The ones on Arch just work. I wonder what we're doing differently.
cabal2arch knows a *lot* about Arch's package system.

 (which is one reason why we don't churn ebuilds out as fast as you
 generate PKBUILDs).  Part of the problem is probably that hackport isn't
 as polished as cabal2arch, but a few other concerns we need to take care
 of are:
 

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


Re: [Haskell-cafe] Re: Proposal: Sum type branches as extended types (as Type!Constructor)

2010-06-07 Thread wren ng thornton

Gabriel Riba wrote:

New proposal draft:

Proposal: Type supplement for constructor specific uses of sum types

Purpose: Avoid error clauses (runtime errors), exception control or Maybe
 types in partially defined (constructor specific) functions on sum types.

As an example, with

   data List a = Nil | Cons a (List a)  

* Actual system, with runtime errors (as in GHC Data.List head) or 
exception throwing or optional Maybe results.


   hd :: List a - a
   hd (Cons x _) - x
   hd Nil - error error: hd: empty list -- error or exception throwing

* Proposed system extending types with a suffix @ Constructor or @
{Constructor1, Constructor2, ..}

   hd :: List @ Cons a - a
   hd (Cons x _) = x

The caller must do pattern matching before applying the constructor-specific
function.


Since the goal is to propagate case analysis information, the syntax 
should reflect that. That is, there should be support for nested 
patterns, e.g.,


cdar :: [...@{_:_:_} - a
cdar (_:x:_) = x

cadr :: [[...@{(_:_):_} - a
cadr ((_:xs):_) = xs

headFromJust :: [Maybe a...@{just _ : _} - a
...

The t...@cons syntax is a nice shorthand, but we need to express the 
arguments to the data constructors in the extended syntax in order to 
support nested patterns.



For delimiting multiple alternatives, it's not clear that comma is the 
best delimiter to use, especially since it could be the data constructor 
for tuples. Perhaps using ; or | would be better. Unless there's a 
syntactic reason for preferring braces over parentheses, perhaps we 
should just use parentheses for symmetry with as-patterns.



Finally, there should also be support for negative patterns, i.e., 
propagation of the failure to match a pattern. One place this is useful 
is for distinguishing 0 from other numbers, which allows removing the 
error branches from functions like division. Sometimes we can't 
enumerate all the positive patterns we want to allow, but it's easy to 
express what should be disallowed.


To match case analysis we should allow for a conjunction of negative 
patterns followed by a positive pattern. Or, if we want to incorporate 
multiple positive patterns, then a conjunction of negative patterns 
followed by a disjunction of positive patterns. (Disjunctive case 
matching has been an independent proposal in the past, and there's 
nothing prohibiting supporting it.)


Thus, if we use | to delimit disjunctions,  to delimit conjunctions, 
and \\ to separate the disjuncts from the conjuncts, given the following 
case analysis:


case x : T of
p1 y1... - e1
p2 y2... - e2
_- eF

The variable x has type T outside of the case expression. Within the 
branch e1 it is given the refinement type t...@{p1 _...} where variables 
bound by the pattern are replaced with wildcards. In branch e2 it is 
given the refinement type t...@{p2 _... \\ p1 _...}. This can be simplified 
to t...@{p2 _...} if the head constructors of p2 and p1 are distinct. And 
in the eF branch x would be given the refinement type t...@{_ \\ p1 _...  
p2_...}.


If this semantics is too hard to implement, we could instead require the 
use of as-patterns for introducing the refinements. The variable 
introduced by @ in the as-pattern would be given the refinement type, 
but the scrutinee would continue to have the unrefined type. This latter 
semantics is common in dependently typed languages, but it's verbose and 
ugly so it'd be nice to avoid it if we can.


Other notes:

Case matching on non-variable expressions would gain no extra support, 
since we have no variable to associate the refinement information with 
(unless as-patterns are used).


A refinement type t...@{p1} can always be weakened to t...@{p1 | p2}. 
Similarly, a refinement type can always be weakened by erasing it.


For type inference, I'd suggest that functions which do not have rigid 
signatures are treated the way they currently are; that is, all 
refinement information is weakened away unless it is explicitly 
requested or returned by a function's type signature. This could be 
improved upon later, but seems like the most reasonable place to start. 
One complication of trying to infer refinement types is that if we are 
too liberal then we won't catch bugs arising from non-exhaustive pattern 
matching.


Syntax-wise, there's no particular reason for distinguishing difference 
from conjunctions under difference. That is, the type t...@{... \\ p1  p2} 
could just as well be written t...@{... \\ p1 \\ p2}. And there's no need 
for conjunctions under disjunction because we can unify the patterns to 
get their intersection. Thus, it might be best to just have disjunction 
and difference for simplicity.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to Show an Operation?

2010-06-07 Thread Evan Laforge
 How should I work around that. I could use two different name function, but
 I don't like this. Would I have to define a typeclass namedFunction which
 all have a name function?

How about a named type:

data Named a = Named {
  val_of :: a,
  name_of :: String
  }

You can put it in Functor and Applicative to get some nice syntax for
modifying the value.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] How to name a mapped function?

2010-06-07 Thread Martin Drautzburg
Hello all,

I like some of the naming conventions in haskell quite a lot, like calling a 
list of something xs, or function which takes a function as a 
parameter ..By as in sortBy or groupBy.

If I have a function, say compute whose last parameter is some value ...
and I create another function, which applies compute to a list of values, 
how would I call this function?

I was tempted to use all, but my original function already returns a list, 
so this would be misleading. Also note that the mapped version, does some 
additional things (remove duplicates), otherwise a new function would hardly 
be justified.


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


Re: [Haskell-cafe] Removing alternate items from a list

2010-06-07 Thread Thomas Hartman
maybe this?

map snd . filter (odd . fst) . zip [1,2..] $ [1,2,3,4,5]

2010/6/6 R J rj248...@hotmail.com:
 What's the cleanest definition for a function f :: [a] - [a] that takes a
 list and returns the same list, with alternate items removed?  e.g., f [0,
 1, 2, 3, 4, 5] = [1,3,5]?

 
 The New Busy is not the old busy. Search, chat and e-mail from your inbox.
 Get started.
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


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


[Haskell-cafe] is there a way to prove the equivalence of these two implementations of (Prelude) break function?

2010-06-07 Thread Thomas Hartman
Here's two implementations of break, a snappy one from the prelude,
and a slow stupid stateful one.

They are quickchecked to be identical.

Is there a way to prove they are identical mathematically? What are
the techniques involved? Or to transform one to the other?

import Control.Monad.State
import Test.QuickCheck

tThis = take 5 . show .  mybreak (400) $ [1..10^7]
tPrel = take 5 . show .  prelbreak (400) $ [1..10^7]


prelbreak p xs = (takeWhile (not . p) xs,dropWhile (not . p) xs) --
fast, more or less as implemented in prelude iiuc

mybreak p xs =  evalState (brk p) ([],xs) -- stateful, slow
brk p = do
  (notsat,remaining) - get
  case remaining of
[] - return (notsat,remaining)
(r:rs) - if p r
then return (notsat,remaining)
else do put (notsat++[r],rs) -- ++ is probaby a
major reason
brk p
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Please check your dependencies on fgl

2010-06-07 Thread Ivan Miljenovic
Thomas Bereknyei are currently re-writing fgl (just about completely
from scratch) and we plan to make an initial release to get feedback
on the API in the next few weeks.

However, I'm sending this email out now to warn people that I highly
doubt any code that was written for the current version of fgl
(http://hackage.haskell.org/package/fgl-5.4.2.2) will work with the
new version.

As such, if your code uses fgl you should ensure that the
specification of the package in your .cabal file has an explicit upper
bound (or indeed just set fgl == 5.4.2.2) to avoid any problems when
we release 6.0.0.0 (we're trying to avoid the problems that plagued
KDE-4 by not claiming in the slightest that the initial few versions
are intended for end users).

I have already directly emailed the maintainers of any and all
packages I could find on Hackage (using Roel van Dijk's wonderful
reverse-dependency mirror at
http://bifunctor.homelinux.net/~roel/hackage/packages/hackage.html),
but just in case I've missed one or there's an as-yet-unreleased
package somewhere in the works, here is the official heads up.

-- 
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] Re: Problems with Haskell Platform

2010-06-07 Thread Brandon S. Allbery KF8NH

On Jun 4, 2010, at 06:54 , Ivan Lazar Miljenovic wrote:

Don Stewart d...@galois.com writes:

However, we have tools for some distros that do this, and some distro
tools support it directly (e.g. bauerbill --hackage on Arch Linux
knows how to ask cabal2arch to translate the .cabal file).

Contribut to yum to allow pulling from hackage, by calling cabal2yum?


I don't know how it is in Arch, but for Gentoo we need to do a lot of
QA'ing to make sure our ebuilds generated with hackport work properly
(which is one reason why we don't churn ebuilds out as fast as you
generate PKBUILDs).  Part of the problem is probably that hackport  
isn't
as polished as cabal2arch, but a few other concerns we need to take  
care

of are:



I don't think anyone just does a conversion and bodges it into the  
package system, regardless of distribution, package system, or  
conversion tool.  (Or language; you don't do it with gems, eggs, or  
CPAN packages either.)  The tool does the boring part of the job for  
you, but of course you want to edit metadata, test, etc. before  
setting it loose.  Release engineering is not optional.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Please check your dependencies on fgl

2010-06-07 Thread Don Stewart
ivan.miljenovic:
 Thomas Bereknyei are currently re-writing fgl (just about completely
 from scratch) and we plan to make an initial release to get feedback
 on the API in the next few weeks.
 
 However, I'm sending this email out now to warn people that I highly
 doubt any code that was written for the current version of fgl
 (http://hackage.haskell.org/package/fgl-5.4.2.2) will work with the
 new version.

How about you give the library a different name then -- so as not to
break all those programs?

A complete rewrite with a new maintainer: fgl-awesome

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


Re: [Haskell-cafe] Issue with connectTo function in network package

2010-06-07 Thread aditya siram
Yeah, that seems to be the issue. When I commented out the ::1..
line it worked.
-deech

On 6/4/10, Jeremy Shaw jer...@n-heptane.com wrote:
 Perhaps it was only listening on IPv6 ? ::1 ?

 - jeremy

 On Thu, Jun 3, 2010 at 10:30 PM, aditya siram aditya.si...@gmail.comwrote:

 Hi all,
 I had an issue where using the connectTo [1] function would fail to
 connect to localhost if my wireless card was turned off. The moment
 I turned on my wireless connection it worked. But if I use connectTo
 with 127.0.0.1 [2] with my network off it works.

 I confirmed that localhost' resolves to 127.0.0.1 by pinging
 localhost from command line with the Internet off.

 Is this a bug in connectTo?

 -deech

 [1] connectTo localhost (PortNumber some_number)
 [2] connectTo 127.0.0.1 (PortNumber some_number)
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe


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


[Haskell-cafe] HP/Cygwin and Curl

2010-06-07 Thread Chris Dornan
Hi,

 

I am trying to install the curl 1.3.5 hackage on the latest Haskell Platform
(2010.1.0.0) on Windows 7.

 

I have installed lib-curl-devel (7.19.6-1) on CygWin but I can't use Cygwin
as (apparently) every attempt to install a package ends like this: 

 

C:\Program Files\Haskell Platform\2010.1.0.0\lib\..\mingw\bin\windres: can't
open temporary file `\/cca01252.irc': No such file or directory

 

Using cabal-install with MSYS generally works. Can HP be used with Cygwin?

 

I have yet to find a way of installing Curl so that the curl hackage will
recognise it-does anybody know how to do this?

 

(I couldn't find any explanation of how HP can be used with Cygwin or how to
install Curl for use with the hackage. If anyone knows where I can get these
that would be fine much appreciated; the Haskell.org outage is compounding
this.)

 

Thanks in advance!

 

Vhris

 

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


[Haskell-cafe] How to set a GHC option for a single module and a specific version of GHC?

2010-06-07 Thread Bernie Pope
Hi,

I'm looking for a way to set a GHC compile option on a specific module
(not every module in the program) but only for a specific version of
GHC. Ideally within the confines of cabal, and in a portable way.

GHC provides the OPTIONS_GHC pragma, but it does not appear to provide
a way for the pragma to fire for specific versions of GHC. Also, I
can't use an #ifdef trick because File-header pragmas are read once
only, before pre-processing the file (e.g. with cpp).

Cabal provides conditional statements and a way to check the version
of GHC, but I can't see a way to get it to only use certain compiler
options for a particular module.

In summary, what I really want is a modified version of the OPTIONS_GHC pragma:

   {-# OPTIONS_GHC ==6.12.1 ... #-}

or a way to tell cabal to use certain compiler options for a
particular module under certain conditions.

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


Re: [Haskell-cafe] ANN: random-fu 0.1.0.0

2010-06-07 Thread wren ng thornton

James Andrew Cook wrote:

In particular, functions such as 'uniform' and 'normal' which directly construct RVars are very useful in 
defining the rvar implementation of other types.  I have been reluctant to drop the rvar function from the 
Distribution class because it is very useful to be able to define other Distribution instances in terms of 
these functions instead of the uglier explicit use of rvarT - e.g. rvarT StdUniform in place of 
just 'stdUniform'. Eventually I'll probably give up this particular objection – probably sooner rather than 
later now that you've made me think about it – but I'm presently in the state where I know it isn't 
right to have both (for some value of right)  but I don't know yet what a better 
solution is, given my conflicting objectives (one of which is to refrain from changing everything at once, so 
users have a chance to keep up with the library's evolution).


Oh I'm sure writing the rvar implementation is prettier. However, since 
clients have to define rvarT too, they can't escape the ugliness :)


If RVar were a datatype, then I could imagine there being performance 
reasons for wanting to define them separately. However, since it isn't, 
it seems like having both methods in the class is just begging for code 
duplication and inconsistency bugs. Without the performance benefit, I 
can't see a reason for having both---


---unless, perhaps, you have a way of deriving a definition of 
rvarT from rvar. If so, then there could be efficiency issues in the 
other direction. I could see some people just giving a pretty 
implementation of rvar and using the inefficient rvarT, whereas other 
people would put up with the ugly in order to have an efficient rvarT... 
(I haven't looked at the package to know if this is actually a possibility)




Making the convenience functions mentioned above return RVarT seems natural, 
but when I tried it I found it made their usage require type annotations in 
many other places to fix the type of the underlying monad, and I have not yet 
decided whether it is worth all that.  I may yet introduce separate RVarT-typed 
convenience functions as well, but I'm not sure I want to do that either.


That's what I was going to propose :)

You could define the RVarT versions, but then keep the RVar versions 
around for their restricted type. That would allow for moving rvar out 
of the class (eliminating possible code duplication bugs) and still 
allow for using uniformT, normalT, etc when defining rvarT.


--
Live well,
~wren
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Removing alternate items from a list

2010-06-07 Thread Ozgur Akgun
i think explicit recursion is quite clean?


f :: [a] - [a]
f (x:y:zs) = x : f zs
f x = x



On 7 June 2010 19:42, Thomas Hartman tphya...@gmail.com wrote:

 maybe this?

 map snd . filter (odd . fst) . zip [1,2..] $ [1,2,3,4,5]

 2010/6/6 R J rj248...@hotmail.com:
  What's the cleanest definition for a function f :: [a] - [a] that takes
 a
  list and returns the same list, with alternate items removed?  e.g., f
 [0,
  1, 2, 3, 4, 5] = [1,3,5]?
 
  
  The New Busy is not the old busy. Search, chat and e-mail from your
 inbox.
  Get started.
  ___
  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




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


Re: [Haskell-cafe] Removing alternate items from a list

2010-06-07 Thread Ozgur Akgun
or, since you don't need to give a name to the second element of the list:


f :: [a] - [a]
f (x:_:xs) = x : f xs
f x = x



On 7 June 2010 20:11, Ozgur Akgun ozgurak...@gmail.com wrote:

 i think explicit recursion is quite clean?


 f :: [a] - [a]
 f (x:y:zs) = x : f zs
 f x = x




 On 7 June 2010 19:42, Thomas Hartman tphya...@gmail.com wrote:

 maybe this?

 map snd . filter (odd . fst) . zip [1,2..] $ [1,2,3,4,5]

 2010/6/6 R J rj248...@hotmail.com:
  What's the cleanest definition for a function f :: [a] - [a] that takes
 a
  list and returns the same list, with alternate items removed?  e.g., f
 [0,
  1, 2, 3, 4, 5] = [1,3,5]?
 
  
  The New Busy is not the old busy. Search, chat and e-mail from your
 inbox.
  Get started.
  ___
  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




 --
 Ozgur Akgun




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


Re: [Haskell-cafe] HP/Cygwin and Curl

2010-06-07 Thread Stephen Tetley
Hi Chris

HP can be used fine with Cygwin. Where a library in the HP is a
binding to a C library, the HP supplies the relevant C library as an
*.a file, e.g libglu32.a and libglut32.a for OpenGL. Pure Haskell
libraries will install fine under Cygwin as well.

Bindings to additional C libraries like Curl are problematic, for one
thing Cygwin static libraries have a different object format to MinGW
ones. With effort and knowledge, FFI libraries/bindings can be made to
work with Cygwin but I don't think anyone is looking at this
systematically (and documenting their methods). Practically speaking
using MinGW / MSYS to build and install bindings is the solution.

Best wishes

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


Re: [Haskell-cafe] How to name a mapped function?

2010-06-07 Thread Brandon S. Allbery KF8NH

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On Jun 6, 2010, at 14:22 , Martin Drautzburg wrote:
If I have a function, say compute whose last parameter is some  
value ...
and I create another function, which applies compute to a list of  
values,

how would I call this function?


The few cases of this in the standard Haskell libraries suggest  
mapCompute.


- --
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH


-BEGIN PGP SIGNATURE-
Version: GnuPG v2.0.10 (Darwin)

iEYEARECAAYFAkwNSsIACgkQIn7hlCsL25XxQACfaUr8Jt31qDTGkvCeNhfs1L+q
ir4AninhHrsxscmnsUl8cchh0DKRMN1m
=dnbt
-END PGP SIGNATURE-
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to name a mapped function?

2010-06-07 Thread Alexander Solla


On Jun 6, 2010, at 11:22 AM, Martin Drautzburg wrote:

If I have a function, say compute whose last parameter is some  
value ...
and I create another function, which applies compute to a list of  
values,

how would I call this function?


computeF is my natural inclination.  F is for Functor.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


RE: [Haskell-cafe] HP/Cygwin and Curl

2010-06-07 Thread Chris Dornan
Thanks ever so much for your clear answer. I have no problem at all with
using MSYS to build libraries that link to libraries built in Windows
land--this seems entirely reasonable.

Is this written down somewhere? I mean I really would like to RTFM! :-)

Also, what's with

C:\Program Files\Haskell
Platform\2010.1.0.0\lib\..\mingw\bin\windres: can't open temporary file
`\/cca01252.irc': No such file or directory

Chris

-Original Message-
From: Stephen Tetley [mailto:stephen.tet...@gmail.com] 
Sent: 07 June 2010 20:19
To: Chris Dornan
Cc: Haskell-Cafe@haskell.org
Subject: Re: [Haskell-cafe] HP/Cygwin and Curl

Hi Chris

HP can be used fine with Cygwin. Where a library in the HP is a binding to a
C library, the HP supplies the relevant C library as an *.a file, e.g
libglu32.a and libglut32.a for OpenGL. Pure Haskell libraries will install
fine under Cygwin as well.

Bindings to additional C libraries like Curl are problematic, for one thing
Cygwin static libraries have a different object format to MinGW ones. With
effort and knowledge, FFI libraries/bindings can be made to work with Cygwin
but I don't think anyone is looking at this systematically (and documenting
their methods). Practically speaking using MinGW / MSYS to build and install
bindings is the solution.

Best wishes

Stephen

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


Re: [Haskell-cafe] How to name a mapped function?

2010-06-07 Thread Stephen Tetley
If the function is changing the size of the list (e.g. by removing
duplicates) a name implying 'mapping' might be misleading.

Maybe something like /process/ or /normalize/
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] How to Show an Operation?

2010-06-07 Thread Claus Reinke
 If I have a problem where I have to select from a set of operations, 
 how

 would I print the result?

 Example: If I can chose from (x+y), (x*y), (x^2+y)...
 and I feed them all into my problem solver
 and it finds that (x*y) is right, how can I print that string?


As others have pointed out, you can't go from operation to representation,
but you can pair operations and expressions with their representations.

Unless your problem solver just tries out a list of known expressions,
you'll probably end up with a proper expression representation as an
algebraic datatype, and a way to bind the variables. However, if you
really only want arithmetic expressions and their values, you could
define your own instances of the classes defining those operations.

A small example of this approach can be found here:

   http://community.haskell.org/~claus/misc/R.hs

It pairs up values with String representations of the expressions
that led to those values

   data R a = R { rep:: String, val:: a }

and defines a Num instance for 'Num a = R a'

Then you can do things like (more examples in the source):

   -- expressions at default type: show the value
   *R foldl (+) 0 [1..4]
   10
   *R foldr (+) 0 [1..4]
   10

   -- expressions at 'R Int' types: show the representation
   *R foldl (+) 0 [1..4]::R Int
   0 + 1) + 2) + 3) + 4)

   *R foldr (+) 0 [1..4]::R Int
   (1 + (2 + (3 + (4 + 0

   *R flip (foldr (+)) [1..4]::R Int-R Int
   \x-(1 + (2 + (3 + (4 + x

   *R flip (foldl (+)) [1..4]::R Int-R Int
   \x-x + 1) + 2) + 3) + 4)

This approach does not easily scale to more complex expressions,
and the code was meant for small demonstrations only, but it might
give you some ideas.

Claus



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


Re: [Haskell-cafe] Issue with connectTo function in network package

2010-06-07 Thread Roman Cheplyaka
Another way round -- it (the server) was only listening on IPv4 and
the (Haskell) client only tried to connect via IPv6.

The bug is described here (with a patch):
http://trac.haskell.org/network/ticket/30

* Jeremy Shaw jer...@n-heptane.com [2010-06-04 16:57:38-0500]
 Perhaps it was only listening on IPv6 ? ::1 ?
 
 - jeremy
 
 On Thu, Jun 3, 2010 at 10:30 PM, aditya siram aditya.si...@gmail.comwrote:
 
  Hi all,
  I had an issue where using the connectTo [1] function would fail to
  connect to localhost if my wireless card was turned off. The moment
  I turned on my wireless connection it worked. But if I use connectTo
  with 127.0.0.1 [2] with my network off it works.
 
  I confirmed that localhost' resolves to 127.0.0.1 by pinging
  localhost from command line with the Internet off.
 
  Is this a bug in connectTo?
 
  -deech
 
  [1] connectTo localhost (PortNumber some_number)
  [2] connectTo 127.0.0.1 (PortNumber some_number)
  ___
  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


-- 
Roman I. Cheplyaka :: http://ro-che.info/
Don't let school get in the way of your education. - Mark Twain
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HP/Cygwin and Curl

2010-06-07 Thread Stephen Tetley
On 7 June 2010 20:44, Chris Dornan ch...@chrisdornan.com wrote:

 Also, what's with

        C:\Program Files\Haskell
 Platform\2010.1.0.0\lib\..\mingw\bin\windres: can't open temporary file
 `\/cca01252.irc': No such file or directory


Hi Chris

I don't know what's going on there, are you using the Windows CLI and
then working with GHC's mingw?

GHC (and thus the Haskell Platform) does ship with a minimal version
of MinGW - includes files, static libraries, gcc, linker etc. - as GHC
needs these pieces in its tool chain, and it means you can use GHC
with the regular Windows CLI. For 'real work' though, you want to be
using a full MSYS / MinGW installation and the MSYS Bash shell.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Cabal -j

2010-06-07 Thread Louis Wasserman
Hmmm.  Now that I've had a chance to rewatch the video, I am enlightened.

Nevertheless, I will confess that I wouldn't mind the idea of just doing an
external parallelism wrapper, running multiple sessions of GHC rather than
making GHC internally parallel.  Hm.

Louis Wasserman
wasserman.lo...@gmail.com
http://profiles.google.com/wasserman.louis


On Thu, Jun 3, 2010 at 11:57 PM, Evan Laforge qdun...@gmail.com wrote:


 Something I wondered from watching that talk, rather than trying to
 make ghc run concurrently internally, can we just have --make, when
 faced with multiple possibilities, pick the first one without a
 'ModuleName.working' file, create such a working file, and then go to?

 Then you can run 'ghc --make X.hs ; ghc --make X.hs ; ...'.

 In fact, isn't that what make -j already does?  I could try it with
 the old style 'ghc -M' and pure makefile, but it turns out to be a lot
 of work to figure out what packages to include and tangle out the
 right .o files and whatnot, work that --make does for me.

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


Re: [Haskell-cafe] How to set a GHC option for a single module and a specific version of GHC?

2010-06-07 Thread Duncan Coutts
On 5 June 2010 09:28, Bernie Pope florbit...@gmail.com wrote:
 Hi,

 I'm looking for a way to set a GHC compile option on a specific module
 (not every module in the program) but only for a specific version of
 GHC. Ideally within the confines of cabal, and in a portable way.

 GHC provides the OPTIONS_GHC pragma, but it does not appear to provide
 a way for the pragma to fire for specific versions of GHC. Also, I
 can't use an #ifdef trick because File-header pragmas are read once
 only, before pre-processing the file (e.g. with cpp).

Not that it helps you immediately, but this is now fixed:

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

I'm not sure which release will include the fix.

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


RE: [Haskell-cafe] HP/Cygwin and Curl

2010-06-07 Thread Chris Dornan
Thanks Stephen--that was related to my original question, about using HP
with Cygwin. The answer seems to be No!--you must use MSYS (for real work).

Or am I just being very slow? (I probably am--sorry!)

Chris


-Original Message-
From: Stephen Tetley [mailto:stephen.tet...@gmail.com] 
Sent: 07 June 2010 21:09
To: Chris Dornan
Cc: Haskell-Cafe@haskell.org
Subject: Re: [Haskell-cafe] HP/Cygwin and Curl

On 7 June 2010 20:44, Chris Dornan ch...@chrisdornan.com wrote:

 Also, what's with

        C:\Program Files\Haskell
 Platform\2010.1.0.0\lib\..\mingw\bin\windres: can't open temporary 
 file
 `\/cca01252.irc': No such file or directory


Hi Chris

I don't know what's going on there, are you using the Windows CLI and then
working with GHC's mingw?

GHC (and thus the Haskell Platform) does ship with a minimal version of
MinGW - includes files, static libraries, gcc, linker etc. - as GHC needs
these pieces in its tool chain, and it means you can use GHC with the
regular Windows CLI. For 'real work' though, you want to be using a full
MSYS / MinGW installation and the MSYS Bash shell.

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


[Haskell-cafe] Issue with connectTo function in network package

2010-06-07 Thread aditya siram
Here's my GHCI session (with my network card off):
Prelude Network Network.Socket connectTo localhost (PortNumber 3000)
*** Exception: connect: does not exist (Connection refused)
Prelude Network Network.Socket connectTo 127.0.0.1 (PortNumber 3000)
{handle: socket: 7}

The OS is Ubuntu (Lucid) Linux. The contents of /etc/hosts and
/etc/nsswitch.conf are:

 cat /etc/nsswitch.conf
# /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc Name Service Switch' for information about this file.

passwd: compat
group:  compat
shadow: compat

hosts:  files mdns4_minimal [NOTFOUND=return] dns mdns4
networks:   files

protocols:  db files
services:   db files
ethers: db files
rpc:db files

netgroup:   nis

 cat /etc/hosts
127.0.0.1   localhost
127.0.1.1   deech-mac-ubuntu

# The following lines are desirable for IPv6 capable hosts
::1 localhost ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts


-deech

On 6/4/10, Roman Cheplyaka r...@ro-che.info wrote:
 * aditya siram aditya.si...@gmail.com [2010-06-03 22:30:33-0500]
 Hi all,
 I had an issue where using the connectTo [1] function would fail to
 connect to localhost if my wireless card was turned off. The moment
 I turned on my wireless connection it worked. But if I use connectTo
 with 127.0.0.1 [2] with my network off it works.

 I confirmed that localhost' resolves to 127.0.0.1 by pinging
 localhost from command line with the Internet off.

 Is this a bug in connectTo?

 -deech

 [1] connectTo localhost (PortNumber some_number)
 [2] connectTo 127.0.0.1 (PortNumber some_number)

 How exactly did it fail? Did it throw an exception? If so, what was the
 exception?

 Which operating system did you observe that under?

 If that was Linux, can you show the contents of the following files on
 that system:

 /etc/nsswitch.conf
 /etc/hosts

 --
 Roman I. Cheplyaka :: http://ro-che.info/
 Don't let school get in the way of your education. - Mark Twain
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe

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


[Haskell-cafe] Haddock on HP failing

2010-06-07 Thread Chris Dornan
Hi,

 

I am trying to use Haddock on the Haskell Platform 2010.1.0.0 and getting

 

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

 

I have tried uninstalling and re-installing HP (just in case) to no avail.

 

Has anybody else seen this?

 

Chris

 

 

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


Re: [Haskell-cafe] How to name a mapped function?

2010-06-07 Thread Ketil Malde
Martin Drautzburg martin.drautzb...@web.de writes:

 If I have a function, say compute whose last parameter is some value ...
 and I create another function, which applies compute to a list of values, 
 how would I call this function?

If I understand you correctly, and it's not simply map . compute (which
I'd leave just like that), I would name the function that works on the
full data set (i.e. list) 'compute' and a sub-function working on a
single element 'compute1'.

-k
-- 
If I haven't seen further, it is by standing in the footprints of giants
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] HP/Cygwin and Curl

2010-06-07 Thread Henk-Jan van Tuyl
On Mon, 07 Jun 2010 21:44:13 +0200, Chris Dornan ch...@chrisdornan.com  
wrote:



Thanks ever so much for your clear answer. I have no problem at all with
using MSYS to build libraries that link to libraries built in Windows
land--this seems entirely reasonable.

Is this written down somewhere? I mean I really would like to RTFM! :-)



Some information can be found at:
  http://www.haskell.org/haskellwiki/Windows#Tools_for_compilation
(improvements are welcome)

Regards,
Henk-Jan van Tuyl


--
http://Van.Tuyl.eu/
http://members.chello.nl/hjgtuyl/tourdemonad.html
--
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Problems with threading?

2010-06-07 Thread Louis Wasserman
While working on the Shootout, I noticed the following benchmarks:

http://shootout.alioth.debian.org/u64/program.php?test=chameneosreduxlang=ghcid=3
http://shootout.alioth.debian.org/u64/program.php?test=chameneosreduxlang=ghcid=3
http://shootout.alioth.debian.org/u64q/program.php?test=chameneosreduxlang=ghcid=3

The same program becomes almost 4 times slower when compiled with --threaded
and run with +RTS -N5 -- even though the multi-core benchmark really only
ever uses one processor.

Other languages seem to have found a way of arranging these threads in a way
such that parallelism actually happens, but as it stands, compiling this
benchmark without --threaded actually makes Haskell competitive against the
genuinely parallel alternatives in other languages...which is unusual by
itself.

I wanted to throw this out for people to discuss, because I'd like to see it
improved.  As it stands, I'm going to submit a version which asks not to be
compiled with --threaded (and has a few other improvements).
http://shootout.alioth.debian.org/u64q/program.php?test=chameneosreduxlang=ghcid=3
Louis Wasserman
wasserman.lo...@gmail.com
http://profiles.google.com/wasserman.louis
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problems with threading?

2010-06-07 Thread Don Stewart
wasserman.louis:
 While working on the Shootout, I noticed the following benchmarks:
 
 http://shootout.alioth.debian.org/u64/program.php?test=chameneosreduxlang=ghc;
 id=3
  http://shootout.alioth.debian.org/u64q/program.php?test=chameneosreduxlang=
 ghcid=3
 
 The same program becomes almost 4 times slower when compiled with --threaded
 and run with +RTS -N5 -- even though the multi-core benchmark really only ever
 uses one processor.

Using -N5 sounds suspicious. There are only 4 cores on the machine.
  
 Other languages seem to have found a way of arranging these threads in a way
 such that parallelism actually happens, but as it stands, compiling this
 benchmark without --threaded actually makes Haskell competitive against the
 genuinely parallel alternatives in other languages...which is unusual by
 itself.
 
 I wanted to throw this out for people to discuss, because I'd like to see it
 improved.  As it stands, I'm going to submit a version which asks not to be
 compiled with --threaded (and has a few other improvements).

What parallelization did you try? Is it a good algorithm?

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


Re: [Haskell-cafe] Issue with connectTo function in network package

2010-06-07 Thread aditya siram
Doing (1) solves my problem. What did I do and why did it work? Thanks
a lot for your help!
-deech

On 6/4/10, Roman Cheplyaka r...@ro-che.info wrote:
 Confirm if any of the following solves the problem:

 1. commenting out (by prepending putting hash sign '#' in the beginning
of the line) the following line in /etc/hosts:

 ::1 localhost ip6-localhost ip6-loopback

 2. executing as root the following command:

 rmmod ipv6

 * aditya siram aditya.si...@gmail.com [2010-06-04 13:51:29-0500]
 Here's my GHCI session (with my network card off):
 Prelude Network Network.Socket connectTo localhost (PortNumber 3000)
 *** Exception: connect: does not exist (Connection refused)
 Prelude Network Network.Socket connectTo 127.0.0.1 (PortNumber 3000)
 {handle: socket: 7}

 The OS is Ubuntu (Lucid) Linux. The contents of /etc/hosts and
 /etc/nsswitch.conf are:

  cat /etc/nsswitch.conf
 # /etc/nsswitch.conf
 #
 # Example configuration of GNU Name Service Switch functionality.
 # If you have the `glibc-doc-reference' and `info' packages installed,
 try:
 # `info libc Name Service Switch' for information about this file.

 passwd: compat
 group:  compat
 shadow: compat

 hosts:  files mdns4_minimal [NOTFOUND=return] dns mdns4
 networks:   files

 protocols:  db files
 services:   db files
 ethers: db files
 rpc:db files

 netgroup:   nis

  cat /etc/hosts
 127.0.0.1   localhost
 127.0.1.1   deech-mac-ubuntu

 # The following lines are desirable for IPv6 capable hosts
 ::1 localhost ip6-localhost ip6-loopback
 fe00::0 ip6-localnet
 ff00::0 ip6-mcastprefix
 ff02::1 ip6-allnodes
 ff02::2 ip6-allrouters
 ff02::3 ip6-allhosts


 -deech

 On 6/4/10, Roman Cheplyaka r...@ro-che.info wrote:
  * aditya siram aditya.si...@gmail.com [2010-06-03 22:30:33-0500]
  Hi all,
  I had an issue where using the connectTo [1] function would fail to
  connect to localhost if my wireless card was turned off. The moment
  I turned on my wireless connection it worked. But if I use connectTo
  with 127.0.0.1 [2] with my network off it works.
 
  I confirmed that localhost' resolves to 127.0.0.1 by pinging
  localhost from command line with the Internet off.
 
  Is this a bug in connectTo?
 
  -deech
 
  [1] connectTo localhost (PortNumber some_number)
  [2] connectTo 127.0.0.1 (PortNumber some_number)
 
  How exactly did it fail? Did it throw an exception? If so, what was the
  exception?
 
  Which operating system did you observe that under?
 
  If that was Linux, can you show the contents of the following files on
  that system:
 
  /etc/nsswitch.conf
  /etc/hosts
 
  --
  Roman I. Cheplyaka :: http://ro-che.info/
  Don't let school get in the way of your education. - Mark Twain
  ___
  Haskell-Cafe mailing list
  Haskell-Cafe@haskell.org
  http://www.haskell.org/mailman/listinfo/haskell-cafe
 

 --
 Roman I. Cheplyaka :: http://ro-che.info/
 Don't let school get in the way of your education. - Mark Twain

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


Re: [Haskell-cafe] Span function

2010-06-07 Thread wren ng thornton

R J wrote:

Can someone provide a hand calculation of:
span ( 0) [-1, -2, -3, 0, 1, 2, -3, -4, -5]?
I know the result is ([-1, -2, -3], [0, 1, 2, -3, -4, -5]), but the recursion 
flummoxes me.
Here's the Prelude definition:


First, let's simplify the definition.

span _ [] = ([], [])
span p xs@(x:xs')
| p x = (x:ys, zs)
| otherwise   = ([], xs)
where
(ys, zs) = span p xs'

===

span _ [] = ([], [])
span p xs@(x:xs')
| p x = let (ys, zs) = span p xs' in (x:ys, zs)
| otherwise   = ([], xs)

===

span p xs =
case xs of
[]  - ([], [])
(x:xs') -
if   p x
then let (ys, zs) = span p xs' in (x:ys, zs)
else ([], xs)


And finally we can pretty up that recursive call (possibly changing 
strictness, but otherwise keeping the same meaning).


span = \p xs -
case xs of
[]  - ([], [])
(x:xs') -
if   p x
then first (x:) (span p xs')
else ([], xs)

And now, the reduction:

span ( 0) (-1:-2:-3:0:1:2:-3:-4:-5:[])

== {delta: unfold the definition of span}
(\ p xs -
case xs of
[]  - ([], [])
(x:xs') -
if   p x
then first (x:) (span p xs')
else ([], xs)) ( 0) (-1:-2:-3:0:1:2:-3:-4:-5:[])

== {beta: reduction of application}
(let p = ( 0) in \ xs -
case xs of
[]  - ([], [])
(x:xs') -
if   p x
then first (x:) (span p xs')
else ([], xs)) (-1:-2:-3:0:1:2:-3:-4:-5:[])


N.B. this next step isn't entirely accurate in Haskell since it looses 
sharing.


== {zeta: reduction of let-binding}
(\ xs -
case xs of
[]  - ([], [])
(x:xs') -
if   ( 0) x
then first (x:) (span ( 0) xs')
else ([], xs)) (-1:-2:-3:0:1:2:-3:-4:-5:[])

== {beta, zeta}
case (-1:-2:-3:0:1:2:-3:-4:-5:[]) of
[]  - ([], [])
(x:xs') -
if   ( 0) x
then first (x:) (span ( 0) xs')
else ([], (-1:-2:-3:0:1:2:-3:-4:-5:[])))

== {iota: reduction of case matching}
let x   = -1
xs' = (-2:-3:0:1:2:-3:-4:-5:[])
in
if   ( 0) x
then first (x:) (span ( 0) xs')
else ([], (-1:-2:-3:0:1:2:-3:-4:-5:[])))

== {zeta, zeta}
if   ( 0) (-1)
then first (-1:) (span ( 0) (-2:-3:0:1:2:-3:-4:-5:[]))
else ([], (-1:-2:-3:0:1:2:-3:-4:-5:[])))

== {beta}
if   -1  0
then first (-1:) (span ( 0) (-2:-3:0:1:2:-3:-4:-5:[]))
else ([], (-1:-2:-3:0:1:2:-3:-4:-5:[])))

Just to be pedantic :)
== {delta}
if   -1 # 0
then first (-1:) (span ( 0) (-2:-3:0:1:2:-3:-4:-5:[]))
else ([], (-1:-2:-3:0:1:2:-3:-4:-5:[])))

== {primitive}
if   True
then first (-1:) (span ( 0) (-2:-3:0:1:2:-3:-4:-5:[]))
else ([], (-1:-2:-3:0:1:2:-3:-4:-5:[])))

== {iota}
first (-1:) (span ( 0) (-2:-3:0:1:2:-3:-4:-5:[]))

We'll ignore that `first` and evaluate under it for clarity, even though 
this isn't accurate for Haskell's call-by-need strategy. Technically 
we'd unfold the definition of `first`, do beta/zeta reduction, and then 
do the following since we'd need to evaluate the scrutinee of the case 
match. I'll go a bit faster now since it's the same.


== {delta, beta, beta, iota, zeta, zeta, beta, delta, primitive, iota}
first (-1:) (first (-2:) (span ( 0) [-3,0,1,2,-3,-4,-5]))

== {delta, beta, beta, iota, zeta, zeta, beta, delta, primitive, iota}
first (-1:) (first (-2:) (first (-3:) (span ( 0) [0,1,2,-3,-4,-5])))

Now things are a little different, so we'll slow down.

== {delta, beta, beta}
first (-1:) (first (-2:) (first (-3:) (
case [0,1,2,-3,-4,-5] of
[]  - ([], [])
(x:xs') -
if   ( 0) x
then first (x:) (span ( 0) xs')
else ([], [0,1,2,-3,-4,-5]) )))

== {iota, zeta, zeta, beta}
first (-1:) (first (-2:) (first (-3:) (
if   0  0
then first (0:) (span ( 0) [1,2,-3,-4,-5])
else ([], [0,1,2,-3,-4,-5]) )))

== {delta, primitive, iota}
first (-1:) (first (-2:) (first (-3:) ([], [0,1,2,-3,-4,-5])))

Now for those `first`s. Again, with pure call-by-need evaluation we'll 
have already done most of this, and will have done it in reverse order. 
For clarity we'll do it inside-out a la call-by-value. (Because of 
strictness analysis, Haskell could perform a hybrid CBN/CBV strategy and 
could actually follow this order if it determined that `first` was 
strict in its second argument.)


== {delta}
first (-1:) (first (-2:) (
(\ f p - case p of (x,y) - (f x, y))
(-3:) ([], [0,1,2,-3,-4,-5])))

== {beta, zeta}
first (-1:) (first (-2:) (
(\ p - case p of (x,y) - ((-3:) x, y))
([], [0,1,2,-3,-4,-5])))

== {beta, zeta}
first (-1:) (first (-2:) (
case ([], [0,1,2,-3,-4,-5]) of (x,y) - ((-3:) x, y)))

== {iota, zeta, 

Re: [Haskell-cafe] Please check your dependencies on fgl

2010-06-07 Thread Ivan Lazar Miljenovic
Oh, great, the email _did_ go out on the mailing lists (what with
haskell.org being down I wasn't sure it would).

Don Stewart d...@galois.com writes:

 ivan.miljenovic:
 Thomas Bereknyei are currently re-writing fgl (just about completely
 from scratch) and we plan to make an initial release to get feedback
 on the API in the next few weeks.
 
 However, I'm sending this email out now to warn people that I highly
 doubt any code that was written for the current version of fgl
 (http://hackage.haskell.org/package/fgl-5.4.2.2) will work with the
 new version.

 How about you give the library a different name then -- so as not to
 break all those programs?

 A complete rewrite with a new maintainer: fgl-awesome

We considered giving it a new name (fgl', etc.) but figured that in the
long term this wouldn't be advantagous.  We feel that the situation is
analogous to QuickCheck: when the new version came out most people kept
using the old one until slowly the momentum shifted and more people
started using the new version (without checking in depth, Roel's Hackage
mirror reports QC-2.x now has 153 reverse dependencies as opposed to 127
reverse dependencies for QC-1.y).

If we changed the name, then the emotional attachment that the Haskell
community has to FGL being the de-facto graph library means that people
would keep using the old version.  Whilst we also face the possible
problems of people not liking the old version and thus automatically
dismissing the new version, I think this is a much more unlikely
scenario.

The overall philosophy is remaining the same: we're just updating the
implementation (letting people pick the Node type rather than
hard-coding it to Int, letting people constrain the label types and also
providing more scope for optimisations).  As such, the new version is
incompatible with the old one; however, if you're only _using_ FGL (as
opposed to making a new instance of the graph types), then the actual
changes to using the new version should be minimal (especially if you're
using it internally in which case you can hard-code the various types in
and not have to worry about the type family usage at all).

As I said, I've directly emailed the maintainers of the packages that
have open-ended dependencies on FGL and thus would have compilation
problems when we release the new version[s]; 7 out of 12 of those
maintainers have already responded within less than 24 hours so I don't
think this is likely to be a problem unless some new package is uploaded
in the near future without proper ranged dependencies.

So as to give you even more of a heads up, here are some more overall
plans Thomas and I have for FGL:

* FGL will still focus on inductive graphs; however the two current
  classes are being combined since it doesn't make much sense in general
  to have a graph that can be decomposed using match but can't be
  composed using  (there might be specific cases where this is true
  such as considering the Cabal package dependency graph; however this
  is likely to be defined internally within some project so users should
  just be careful about how they use it to ensure they don't add
  arbitrary nodes/edges that don't make sense; note that the new Show
  and Read instances take advantage of this by using Contexts as the
  basis of this instance).

* The ability to have proper Eq, Show and Read instances for graphs with
  pre-defined helper functions implementors can use (currently
  Data.Graph.Inductive.Tree has a pretty output for Show but no Read
  instance, and graphs cannot have equality due to overlapping instance
  problems).

* Splitting the library up into the base classes + sample instances (the
  fgl package) and a separate fgl-algorithms package (analogous to Dan
  Doel's vector-algorithms; this will be comprised of what is currently
  in the Data.Graph.Inductive.Query.* modules as well as the
  Data.Graph.Analysis.Algorithms.* modules in my Graphalyze library.
  The Data.Graph.Inductive.Graphviz module will also be scrapped in
  favour of my graphviz library.

* By default, fgl will ship with two default instances: the one
  currently in Data.Graph.Inductive.PatriciaTree and also a generic
  Map-based one that lets people choose their own Node type (i.e. the
  key type in the Map).  Any other suitable instances that we can think
  of (e.g. Thomas has the beginnings of a vector-based one) we'll ship
  in separate packages (e.g. fgl-vector).

If anyone has a good reason to object to any of these plans, we are
willing to be persuaded out of them.  This is why the 6.z series of fgl
will be technology previews to slowly build up what FGL does and gauge
the reaction of the Haskell community.

-- 
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] Please check your dependencies on fgl

2010-06-07 Thread Don Stewart
ivan.miljenovic:
 Oh, great, the email _did_ go out on the mailing lists (what with
 haskell.org being down I wasn't sure it would).
 
 Don Stewart d...@galois.com writes:
 
  ivan.miljenovic:
  Thomas Bereknyei are currently re-writing fgl (just about completely
  from scratch) and we plan to make an initial release to get feedback
  on the API in the next few weeks.
  
  However, I'm sending this email out now to warn people that I highly
  doubt any code that was written for the current version of fgl
  (http://hackage.haskell.org/package/fgl-5.4.2.2) will work with the
  new version.
 
  How about you give the library a different name then -- so as not to
  break all those programs?
 
  A complete rewrite with a new maintainer: fgl-awesome
 
 We considered giving it a new name (fgl', etc.) but figured that in the
 long term this wouldn't be advantagous.  We feel that the situation is
 analogous to QuickCheck: when the new version came out most people kept
 using the old one until slowly the momentum shifted and more people
 started using the new version (without checking in depth, Roel's Hackage
 mirror reports QC-2.x now has 153 reverse dependencies as opposed to 127
 reverse dependencies for QC-1.y).


Just remember: you are now the maintainer of a package in the Haskell
Platform, and that has some burden on ensuring stability and safety.
API-breaking changes are fine, as long as well planned, and it may be up
to 12 months before the HP can adopt an API changing release of a
package.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Haddock on HP failing

2010-06-07 Thread Ivan Lazar Miljenovic
Chris Dornan ch...@chrisdornan.com writes:

 I am trying to use Haddock on the Haskell Platform 2010.1.0.0 and getting

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

Where did you install GHC to (just checking...)?

-- 
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


[Haskell-cafe] After `readFile`, why cannot i `writeFile` ?

2010-06-07 Thread zaxis

hitSSQ :: String - [Int] - IO ()
hitSSQ no hitNum = do
let newNum = unwords $ [no] ++ map (\n - show n) hitNum
hitNums - fmap lines $ readFile test.txt
writeFile test.txt $ unlines $ hitNums ++ [newNum]

*** Exception: test.txt: openFile: resource busy (file is locked)


Sincerely!

-
e^(π⋅i) + 1 = 0
-- 
View this message in context: 
http://old.nabble.com/After-%60readFile%60%2C-why-cannot-i-%60writeFile%60tp28793133p28793133.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


Re: [Haskell-cafe] Please check your dependencies on fgl

2010-06-07 Thread Ivan Lazar Miljenovic
Don Stewart d...@galois.com writes:

 ivan.miljenovic:
 
 We considered giving it a new name (fgl', etc.) but figured that in the
 long term this wouldn't be advantagous.  We feel that the situation is
 analogous to QuickCheck: when the new version came out most people kept
 using the old one until slowly the momentum shifted and more people
 started using the new version (without checking in depth, Roel's Hackage
 mirror reports QC-2.x now has 153 reverse dependencies as opposed to 127
 reverse dependencies for QC-1.y).


 Just remember: you are now the maintainer of a package in the Haskell
 Platform, and that has some burden on ensuring stability and safety.
 API-breaking changes are fine, as long as well planned, and it may be up
 to 12 months before the HP can adopt an API changing release of a
 package.

Oh, we know that: we envisage it being a few months before anyone starts
using the new version of FGL.

One change I might make in a released version before then is if I'm
successful during AusHack in writing at least a start towards the
generic graph classes, we might make a 5.x release of fgl that has the
instances of the generic classes and then port at least graphviz over to
using the new generic classes.  I realise that these changes as well
won't necessarily go into the HP straight away, but it should help
improve cross-library usage down the track.

off-topic
I was discussing the state of the graph libraries with Edward Kmett
yesterday, and here's what I said as what I envisage happening over the
next year or so:

* The generic graph classes will form a base library for accessing and
  using graphs.  It won't define any graph types itself, but will serve
  as a base compatability layer between libraries.  The focus of this
  will be a class I'm currently calling GraphLike which let's you access
  the vertices and edges of any type that matches the formal definition
  of a graph that it's a set of vertices V and a set of edges E such
  that forall e \in E, there exists two vertices v1, v2 \in V (not
  neccessarily distinct) such that there are two mappings source e =
  v1 and target e = v2 (or whatever you want to call them) between
  each edge and the set of vertices.

  Basically, this class is an accessor class, so it will work for things
  like package dependency graph in Cabal, etc. for graph-like types
  which it might not make sense to add or change vertices and edges in
  the graph.  Whether there will also be a class for adding/removing
  elements is currently up in the air, as this might not make sense for
  all graph types.  As such, those functions that don't need to edit
  graphs (e.g. graphToDot in graphviz) will be able to just use these.

* The set of FGL libraries will form an initial to intermediary layer of
  types.  If your problem isn't large and the inductive nature is
  applicable, then FGL will probably be your best bet.

* Edward's co-monadic graph library will be an intermediary to advanced
  layer; it sounds quite interesting but might not be as easy to use due
  to the types changing when you add a vertex, etc.

* fasta on #haskell{,-blah} has suggested that I read through the Boost
  Graph Library documentation and consider writing a graph library based
  upon that (and hints that he's once written a high-performance graph
  library in Haskell on this model).  As such, I'll have a look at this
  down the track during my copious free time :s (Edward thinks it might
  even fit in to his co-monadic approach, so we'll see).

What I'm after here is more sharing between graph types and libraries:
rather than defining something on just one specific graph type,
generalise it as much as you can (to avoid writing a new Graphviz
transformation library for every graph type for example).
/off-topic

-- 
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] After `readFile`, why cannot i `writeFile` ?

2010-06-07 Thread Ivan Lazar Miljenovic
zaxis z_a...@163.com writes:

 hitSSQ :: String - [Int] - IO ()
 hitSSQ no hitNum = do
 let newNum = unwords $ [no] ++ map (\n - show n) hitNum
 hitNums - fmap lines $ readFile test.txt
 writeFile test.txt $ unlines $ hitNums ++ [newNum]

 *** Exception: test.txt: openFile: resource busy (file is locked)

You're currently reading the file; finish reading it and close it before
you write over it (or else use WriteRead mode or whatever it's called
and call openFile explicitly rather than using readFile and writeFile).

-- 
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


[Haskell-cafe] Reminder: Deadline to submit talks on your commercial use of Haskell to CUFP in 7 days

2010-06-07 Thread Don Stewart
This is a final call for speakers at CUFP 2010 -- the Commercial Users of FP
Workshop, in Baltimore.

CUFP is a chance for you to talk about your use of functional programming in a
commercial setting -- and we'd love to see some Haskell speakers, given the 
recent
spike in recruiting :-)

You can see the fine videos from last year's CUFP on the all new CUFP site:
http://cufp.org

Time to stand up and be counted!

-- Don




2010 Call for Presentations

http://cufp.org

Sponsored by SIGPLAN
Co-located with ICFP 2010
Baltimore, MD USA
Oct 1-2
Submission Deadline 15 June 2010

Functional programming languages have been a hot topic of academic research for
over 35 years, and have seen an ever larger practical impact in settings
ranging from tech startups to financial firms to biomedical research labs. At
the same time, a vigorous community of practically-minding functional
programmers has come into existence.

CUFP is designed to serve this community. The annual CUFP workshop is a place
where people can see how others are using functional programming to solve real
world problems; where practitioners meet and collaborate; where language
designers and users can share ideas about the future of their favorite
language; and where one can learn practical techniques and approaches for
putting functional programming to work.

Giving a CUFP Talk

If you have experience using functional languages in a practical setting, we
invite you to submit a proposal to give a talk at the workshop. We're looking
for two kinds of talks:

Experience reports are typically 25 minutes long, and aim to inform
participants about how functional programming plays out in real-world
applications, focusing especially on lessons learned and insights gained.
Experience reports don't need to be highly technical; reflections on the
commercial, management, or software engineering aspects are, if anything, more
important. You do not need to submit a paper!

Technical talks are expected to be 30-45 minutes long, and should focus on
teaching the audience something about a technical technique or methodology,
from the point of view of someone who has seen it play out in practice. These
talks could cover anything from techniques for building functional concurrent
applications, to managing dynamic reconfigurations, to design recipes for using
types effectively in large-scale applications. While these talks will often be
based on a particular language, they should be accessible to a broad range of
functional programmers.

If you are interested in offering a talk, or nominating someone to do so, send
an e-mail to francesco(at)erlang-consulting(dot)com or
yminsky(at)janestreet(dot)com by 15 June 2010 with a short description of what
you'd like to talk about or what you think your nominee should give a talk
about. Such descriptions should be about one page long.

There will be no published proceedings, as the meeting is intended to be more a
discussion forum than a technical interchange.

Program Committee

Francesco Cesarini, Erlang Training and Consulting (Co-Chair)
Tim Dysinger, Sonian Networks
Alain Frisch, LexiFi
Nick Gerakines, Chegg
Adam Granicz, IntelliFactory
Amanda Laucher
Romain Lenglet, Google Japan
Yaron Misky, Jane Street (Co-Chair)
Mary Sheeran, Chalmers
Don Stewart, Galois
Dean Wampler, DRW Trading
More information

For more information on CUFP, including videos of presentations from previous
years, take a look at the CUFP website at http://cufp.org. Note that
presenters, like other attendees, will need to register for the event.
Presentations will be video taped and presenters will be expected to sign an
ACM copyright release form. Acceptance and rejection letters will be sent out
by July 15th. Note that ICFP proper is on Sep. 27-29th.1G
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] is there a way to prove the equivalence of these two implementations of (Prelude) break function?

2010-06-07 Thread Alexander Solla


On Jun 5, 2010, at 8:10 PM, Thomas Hartman wrote:


Is there a way to prove they are identical mathematically? What are
the techniques involved? Or to transform one to the other?


Typically, the easiest way to prove that functions f g are equivalent  
is to (1) show that their domains are the same, and (2) show that for  
every x in the domain, f x = g x.


Usually, this amounts to comparing and understanding the function  
definitions, since each definition if a proof that the function  
relates a value x to f x, its image under f.


So a proof that f = g is a proof that a characterization of f is the  
same as the characterization for g.  For exposition, I'll do the  
analysis for the Prelude function.  You might note how much like  
evaluating the function Generating the characterization for a  
caseful or stateful function requires quantifying over cases or  
states.  Exercise left to the reader.


  prelbreak p xs = (takeWhile (not . p) xs,dropWhile (not . p) xs)

We seek a characterization of prelbreak in the following terms:
prelbreak is a function that accepts a proposition p and a list of  
x's, and returns a ...


To that end, note that prelbreak is a product function.  It returns  
a pair of images of p and xs, under the functions (\p xs - takeWhile  
(not . p) xs) and (\p xs - dropWhile (not . p) xs).


takeWhile is kind of tricky to describe in English, since it depends  
on the intrinsic order of the xs.  But in this case it returns the  
largest prefix of xs for which no x satisfies p.


Dually, (\p xs - dropWhile (not . p) xs) returns the list complement  
(taken in xs) of the image of (\p xs - takeWhile (not . p) xs).  (I  
guess this is a very high level characterization, especially since I  
didn't derive it from the function's definition.  The level of detail  
you want in your proof is up to you)


So, finally, prelbreak accepts a proposition p and a list xs, and  
returns a pair whose first element is the largest prefix of xs for  
which no x satisfies p, and whose second element is the complement of  
the first, taken in xs.


To do it for mybreak, you would have to pick apart the semantics of  
evalState and brk, and recharacterize them.  That could be a little  
trickier mathematically, or straight forward.  It depends on how you  
end up quantifying over monadic actions.  Either way, it will be a LOT  
like evaluating the code.  (After all, the function definition is a  
proof that the function relates each x to f x)

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


Re: [Haskell-cafe] After `readFile`, why cannot i `writeFile` ?

2010-06-07 Thread Bill Atkins
readFile reads the file lazily so it isn't closed until the entire contents 
have been consumed.

Try System.IO.Strict.readFile, which will read the entire file at once.

zaxis z_a...@163.com writes:

 hitSSQ :: String - [Int] - IO ()
 hitSSQ no hitNum = do
let newNum = unwords $ [no] ++ map (\n - show n) hitNum
hitNums - fmap lines $ readFile test.txt
writeFile test.txt $ unlines $ hitNums ++ [newNum]
 
 *** Exception: test.txt: openFile: resource busy (file is locked)

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


Re: [Haskell-cafe] is there a way to prove the equivalence of these two implementations of (Prelude) break function?

2010-06-07 Thread Alexander Solla


On Jun 7, 2010, at 4:10 PM, Alexander Solla wrote:

For exposition, I'll do the analysis for the Prelude function.  You  
might note how much like evaluating the function


Correction:

You might note how much like evaluating the function generating the  
analysis is.

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


Re: [Haskell-cafe] Removing alternate items from a list

2010-06-07 Thread Bill Atkins
alts :: [a] - [a]
alts xs = map fst . filter snd $ zip xs (cycle [False, True])

Prelude alts [0, 1..5]
[1,3, 5]

On Sunday Jun 6, 2010, at 10:46 AM, R J wrote:

 What's the cleanest definition for a function f :: [a] - [a] that takes a 
 list and returns the same list, with alternate items removed?  e.g., f [0, 1, 
 2, 3, 4, 5] = [1,3,5]?
 
 
 The New Busy is not the old busy. Search, chat and e-mail from your inbox. 
 Get started. ___
 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] Issue with connectTo function in network package

2010-06-07 Thread Brandon S. Allbery KF8NH

On Jun 4, 2010, at 15:15 , aditya siram wrote:

Doing (1) solves my problem. What did I do and why did it work? Thanks
a lot for your help!


Its the problem I pointed out; you are doing an IPv4 connect but  
localhost was resolving to an IPv6 address.  This is annoyingly  
common on Linux.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Problems with threading?

2010-06-07 Thread Isaac Gouy


--- On Mon, 6/7/10, Don Stewart d...@galois.com wrote:

 From: Don Stewart d...@galois.com
 Subject: Re: [Haskell-cafe] Problems with threading?
 To: Louis Wasserman wasserman.lo...@gmail.com
 Cc: Haskell Café List haskell-cafe@haskell.org
 Date: Monday, June 7, 2010, 2:50 PM
 wasserman.louis:
  While working on the Shootout, I noticed the following
 benchmarks:
  
  http://shootout.alioth.debian.org/u64/program.php?test=chameneosredux〈=ghc;
  id=3
   http://shootout.alioth.debian.org/u64q/program.php?test=chameneosredux〈=
  ghcid=3
  
  The same program becomes almost 4 times slower when
 compiled with --threaded
  and run with +RTS -N5 -- even though the multi-core
 benchmark really only ever
  uses one processor.
 
 Using -N5 sounds suspicious. There are only 4 cores on the
 machine.


-N5 is likely to have been your orsuggestion for getting the most out of ghc 
6.10.* :-)

   
-snip-
  I wanted to throw this out for people to discuss,
  because I'd like to see it improved.

As Louis has already mentioned this to me, I'll take the opportunity to sketch 
out a simple approach - 


1) GHC programs compiled without -threaded and run without +RTS -N are already 
shown for x86 and x64

http://shootout.alioth.debian.org/u32/compare.php?lang=ghc

http://shootout.alioth.debian.org/u64/compare.php?lang=ghc


2) For quad-core, the GHC programs will all be compiled with -threaded and all 
run with +RTS -N4 


3) That seems to match the approach taken with Erlang, where all the programs 
on quad-core run with smp built into the vm, and all the programs on one core 
run without smp built into the vm. 




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


Re: [Haskell-cafe] Problems with threading?

2010-06-07 Thread Don Stewart
igouy2:
 As Louis has already mentioned this to me, I'll take the opportunity
 to sketch out a simple approach - 
 
 
 1) GHC programs compiled without -threaded and run without +RTS -N are 
 already shown for x86 and x64
 
 http://shootout.alioth.debian.org/u32/compare.php?lang=ghc
 
 http://shootout.alioth.debian.org/u64/compare.php?lang=ghc
 
 
 2) For quad-core, the GHC programs will all be compiled with -threaded and 
 all run with +RTS -N4 
 
 
 3) That seems to match the approach taken with Erlang, where all the
 programs on quad-core run with smp built into the vm, and all the
 programs on one core run without smp built into the vm. 
 

Yep, that's fine.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Re: Reporting a problem with binary-0.5

2010-06-07 Thread Pete Chown

Ketil Malde wrote:


There was a deliberate change in strictness in 0.5 making binary strict,
which apparently speeds up GHC.


Ah okay.  I suppose that passes the buck to network-dns.  Presumably it 
could be fixed fairly simply by requiring binary  0.5 (as you 
suggested).  Ideally, though, the implementation of its infinite random 
list would be changed.  This would avoid having a dependency on a 
package which is no longer current.


Pete

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


[Haskell-cafe] Re: haskell.org down?

2010-06-07 Thread Benjamin L. Russell
Ozgur Akgun ozgurak...@gmail.com writes:

 http://downforeveryoneorjustme.com/www.haskell.org-- Ozgur Akgun

Same problem here since two days ago.

Apparently, the server just went back up.  Anybody know what kept the
server down for so long?

-- Benjamin L. Russell
-- 
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ 

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


[Haskell-cafe] Is www.haskell.org down?

2010-06-07 Thread Benjamin L. Russell
Since yesterday, I have been unable to connect to www.haskell.org.  Is
the site down?

-- Benjamin L. Russell
-- 
Benjamin L. Russell  /   DekuDekuplex at Yahoo dot com
http://dekudekuplex.wordpress.com/
Translator/Interpreter / Mobile:  +011 81 80-3603-6725
Furuike ya, kawazu tobikomu mizu no oto. -- Matsuo Basho^ 

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


[Haskell-cafe] Re: Re: Re: Difference between div and /

2010-06-07 Thread Maciej Piechotka
On Thu, 2010-06-03 at 06:48 -0700, mo...@deepbondi.net wrote:
 
  On Thu, 3 Jun 2010, Maciej Piechotka wrote:
 
  Hmm. Thanks - however I fail to figure out how to do something like:
 
  generate a random number with normal distribution with average avg and
  standard deviation stdev.
 
  Unfortunately the package is restricted to discrete distributions so far.
 
 Shameless self-advertisement: The random-fu package (whimsically named,
 sorry) implements a modest variety of continuous distributions with what I
 believe to be a user-friendly and flexible interface.
 
 This thread inspired me to finish up and upload the 0.1 release (just
 announced on haskell-cafe as well).  The public interface is slightly
 different from earlier releases and the haddock docs for the new one
 failed to build on hackage, but earlier versions have essentially the same
 end-user interface aside from some changes in the module export lists so
 if you'd like to get an idea of the basic spirit of the system you can
 browse the docs for the earlier releases.  Alternatively, feel free to
 browse the source and steal some of the implementations (many of which
 were, in turn, translated from other sources such as wikipedia or the
 Numerical Recipes book).
 
 Unfortunately, the old documentation is much sparser and terser than the
 new documentation that failed to build, but if nothing else you can
 download and build the docs yourself for the new one.

I build docs anyway ;). I discovered random-fu just before 0.1 release
and it have nice, monadic interface :D

I guess all it lacks is something to 'just' use IO without state etc.
for fast typing in ghci - otherwise is IMHO perfect.

Regards


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[Haskell-cafe] Proposal filed to GHC, expecting supporters vote: Type supplement for constructor specific uses of sum types

2010-06-07 Thread Gabriel Riba
Hi!

I have filed a new proposal to GHC bugs/whishes process based on the previous
  discussion here.

The proposal address is

http://hackage.haskell.org/trac/ghc/ticket/4116#comment:2

( I had some formatting problems with the first posting, 
  so it is better read at comment:2)

Voters admitted:

GHC prioritizes bugs/features based on the length of supporters email list at
the CC field of the ticket as explained here:

http://hackage.haskell.org/trac/ghc/wiki/ReportABug#Ifalreadyreportedvoteforit

You may add also any change proposal.

Cheers.

Gabriel




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


[Haskell-cafe] Re: Help with Bird problem 3.3.3

2010-06-07 Thread Günther Schmidt

Hi,

I'm just re-reading the book again, this time doing the exercises though :)

Is there a site with solutions for the exercises?

Günther

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


[Haskell-cafe] Re: PDF generation?

2010-06-07 Thread Maciej Piechotka
On Tue, 2010-06-01 at 21:45 +0300, Yitzchak Gale wrote:
 I wrote:
  I have often generated PostScript from Haskell...
  Then you convert the PS to PDF using any of the nice
  utilities around for that
 
 Pierre-Etienne Meunier wrote:
  Isn't there a problem with non-type 1 vectorial fonts being
  rasterized during this conversion ?
 
 No.
 
 PDF is just a simplified, compressed encoding of PostScript.
 Unless there is some special reason to do so, why would
 a conversion utility go to the trouble of rasterizing fonts
 instead of just copying them in?
 
 Perhaps something like ImageMagick might do that; its
 internal format is a raster.
 
 Regards,
 Yitz

PDF is not just simplified, compressed encoding of PostScript. Or at
least - LaTeX have some features PDF-only.

For example PDF can have hyper-links (both to local and external
content). It can be scripted in JavaScript (don't ask me why) and can
have form (OK. So I can fill them and print probably). 

Regards 


signature.asc
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] ANN: random-fu 0.1.0.0

2010-06-07 Thread James Andrew Cook

On Jun 4, 2010, at 9:42 PM, wren ng thornton wrote:

---unless, perhaps, you have a way of deriving a definition of rvarT from 
 rvar. If so, then there could be efficiency issues in the other direction. I 
 could see some people just giving a pretty implementation of rvar and using 
 the inefficient rvarT, whereas other people would put up with the ugly in 
 order to have an efficient rvarT... (I haven't looked at the package to know 
 if this is actually a possibility)
 

This is precisely the present state of affairs, and I'm probably the worst 
offender.  In fact, most of the distributions provided in the library just use 
the default implementation of rvarT, which as you guessed has a bit of a 
penalty associated.  I've had it in the back of my mind for quite a while to 
revisit that design, it just hasn't been enough of a priority to actually do 
it.  I've been having more fun mucking about in the numerical code :)

 
 Making the convenience functions mentioned above return RVarT seems natural, 
 but when I tried it I found it made their usage require type annotations in 
 many other places to fix the type of the underlying monad, and I have not 
 yet decided whether it is worth all that.  I may yet introduce separate 
 RVarT-typed convenience functions as well, but I'm not sure I want to do 
 that either.
 
 That's what I was going to propose :)
 
 You could define the RVarT versions, but then keep the RVar versions around 
 for their restricted type. That would allow for moving rvar out of the class 
 (eliminating possible code duplication bugs) and still allow for using 
 uniformT, normalT, etc when defining rvarT.
 

Yea, now that you put that in words, I like the idea and see that it wouldn't 
be as disruptive as I subliminally assumed.  I'll probably get to it sooner 
rather than later - thanks!

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


Re: [Haskell-cafe] Re: PDF generation?

2010-06-07 Thread Brandon S. Allbery KF8NH

On Jun 5, 2010, at 10:37 , Maciej Piechotka wrote:

PDF is not just simplified, compressed encoding of PostScript. Or at
least - LaTeX have some features PDF-only.


I think that has more to do with the fact that pdftex/pdflatex is  
tightly integrated with a dvi converter that understands many PDF- 
specific \special{}s.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] Re: PDF generation?

2010-06-07 Thread Ivan Miljenovic
On 6 June 2010 00:37, Maciej Piechotka uzytkown...@gmail.com wrote:

 PDF is not just simplified, compressed encoding of PostScript. Or at
 least - LaTeX have some features PDF-only.

 For example PDF can have hyper-links (both to local and external
 content). It can be scripted in JavaScript (don't ask me why) and can
 have form (OK. So I can fill them and print probably).

The form stuff is also for online submission, and the javascript
allows editing of what is possible.

For example (requires Adobe Reader plugin, which I don't have and thus
haven't seen it myself) this form (I believe) auto-fills in some
details and saves a copy online, etc.:
https://forms.australia.gov.au/forms/aec/Electoral%20enrolment/


 Regards

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





-- 
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] Re: PDF generation?

2010-06-07 Thread Brandon S. Allbery KF8NH

should have included this in previous...

On Jun 5, 2010, at 10:37 , Maciej Piechotka wrote:

For example PDF can have hyper-links (both to local and external
content). It can be scripted in JavaScript (don't ask me why) and can
have form (OK. So I can fill them and print probably).



The only thing that stops PostScript from doing this is that it's  
almost always used with devices where neither feature is useful.   
Indeed, PostScript is fully network capable in theory; in practice I  
doubt many printers implement the entire I/O model.


--
brandon s. allbery [solaris,freebsd,perl,pugs,haskell] allb...@kf8nh.com
system administrator [openafs,heimdal,too many hats] allb...@ece.cmu.edu
electrical and computer engineering, carnegie mellon universityKF8NH




PGP.sig
Description: This is a digitally signed message part
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] A question on existential types and Church encoding

2010-06-07 Thread Ryan Ingram
 In the new type, the parameter 'a' is misleading. It has no connection to
 the
 'a's on the right of the equals sign. You might as well write:

  type CB = forall a. a - a - a

On Tue, Jun 1, 2010 at 12:40 PM, Cory Knapp cory.m.kn...@gmail.com wrote:
 Ah! That makes sense. Which raises a new question: Is this type too
 general? Are there functions which are semantically non-boolean which fit
 in that type

Actually, this type is *less* general, in that it has less members.

Consider, what boolean is represented by this?
q :: CB Int
q = (+)

Whereas the (forall a. a - a - a) must work on *any* type, so it has
far less freedom to decide what to do, and therefore there are less
possible implementations.  In fact, if we treat all bottoms as equal,
I believe these are all of the distinguishible implementations of this
function:

t a _ = a
f _ a = a

a1 = undefined
a2 _ = undefined
a3 _ _ = undefined
a4 a b = seq b a
a5 a b = seq a b
a6 a = seq a (\_ - a)
a7 a = seq a (\b - b)

Without allowing bottoms, t and f are the only implementations.

Here's some discriminators that are bottom if the passed in function
is the first and not in the group of second:

disc_t_f b = b undefined ()
disc_f_t b = b () undefined
disc_6_t b = seq (b undefined) ()

disc_1_any b = seq b ()
disc_2_34567tf b = seq (b ()) ()
disc_3_4567tf b = seq (b () ()) ()
disc_4_6t b = b () undefined
disc_5_f b = b undefined ()
disc_7_6 b = b () undefined
disc_6_5 = seq (b undefined) ()

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


Re: [Haskell-cafe] After `readFile`, why cannot i `writeFile` ?

2010-06-07 Thread zaxis




Bill Atkins-6 wrote:
 
 readFile reads the file lazily so it isn't closed until the entire
 contents have been consumed.
 
 Try System.IO.Strict.readFile, which will read the entire file at once.
 Yes, and i can use appendFile too.
 
 appendFile ssqHitNum.txt $ unwords $ [no] ++ map (\n - show n) hitNum
 ++ [\n]
 
 zaxis z_a...@163.com writes:
 
 hitSSQ :: String - [Int] - IO ()
 hitSSQ no hitNum = do
let newNum = unwords $ [no] ++ map (\n - show n) hitNum
hitNums - fmap lines $ readFile test.txt
writeFile test.txt $ unlines $ hitNums ++ [newNum]
 
 *** Exception: test.txt: openFile: resource busy (file is locked)
 
 ___
 Haskell-Cafe mailing list
 Haskell-Cafe@haskell.org
 http://www.haskell.org/mailman/listinfo/haskell-cafe
 
 


-
e^(π⋅i) + 1 = 0
-- 
View this message in context: 
http://old.nabble.com/After-%60readFile%60%2C-why-cannot-i-%60writeFile%60tp28793133p28812627.html
Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com.

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


  1   2   >