Re: [GHC] #3843: Merge plugins into HEAD

2011-06-30 Thread GHC
#3843: Merge plugins into HEAD
-+--
Reporter:  dreixel   |Owner:  simonpj 
Type:  task  |   Status:  new 
Priority:  normal|Milestone:  7.2.1   
   Component:  Compiler  |  Version:  6.13
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by simonpj):

 I'm not sure what support for home-package plugins is.  I certainly
 simplified the patch when testing it; I removed several small modules,
 eliminated unnecessary module loops; simplified data types.  But I didn't
 know that I had removed any functionality.  If so, apologies.  Happy to
 discuss.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3843#comment:31
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] #5290: Add UNPACK support to Template Haskell

2011-06-30 Thread GHC
#5290: Add UNPACK support to Template Haskell
---+
Reporter:  mikhail.vorozhtsov  |   Owner:  
Type:  feature request |  Status:  new 
Priority:  normal  |   Component:  Template Haskell
 Version:  7.1 |Keywords:  
Testcase:  |   Blockedby:  
  Os:  Unknown/Multiple|Blocking:  
Architecture:  Unknown/Multiple| Failure:  None/Unknown
---+
 I've just hacked it in:
 {{{
 $ ghci -XTemplateHaskell
 GHCi, version 7.1.20110630: http://www.haskell.org/ghc/  :? for help
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 λ import Language.Haskell.TH
 λ runQ [d| data T = T {-# UNPACK #-} !Int |]
 Loading package array-0.3.0.2 ... linking ... done.
 Loading package containers-0.4.0.0 ... linking ... done.
 Loading package pretty-1.0.2.0 ... linking ... done.
 Loading package template-haskell ... linking ... done.
 [DataD [] T [] [NormalC T [(Unpacked,ConT GHC.Types.Int)]] []]
 λ
 }}}
 TH.hs:
 {{{
 {-# LANGUAGE TemplateHaskell #-}

 module TH where

 import Language.Haskell.TH

 d :: Q [Dec]
 d = return [DataD [] n [] [NormalC n [(Unpacked,ConT ''Int)]] []]
   where n = mkName T
 }}}
 Main.hs:
 {{{
 {-# LANGUAGE TemplateHaskell #-}

 import TH

 $(d)

 instance Show T where
   show (T i) = show i

 main = putStrLn $ show (T 10)
 }}}
 Compiling and running:
 {{{
 $ ghc -ddump-splices -fforce-recomp Main.hs
 [1 of 2] Compiling TH   ( TH.hs, TH.o )
 [2 of 2] Compiling Main ( Main.hs, Main.o )
 Loading package ghc-prim ... linking ... done.
 Loading package integer-gmp ... linking ... done.
 Loading package base ... linking ... done.
 Loading package ffi-1.0 ... linking ... done.
 Loading package pretty-1.0.2.0 ... linking ... done.
 Loading package array-0.3.0.2 ... linking ... done.
 Loading package containers-0.4.0.0 ... linking ... done.
 Loading package template-haskell ... linking ... done.
 Main.hs:1:1: Splicing declarations
 d
   ==
 Main.hs:5:3
 data T = T {-# UNPACK #-} !Int
 Linking Main ...
 $ ./Main
 10
 }}}
 Please consider merging.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5290
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] #5288: Less noisy version of -fwarn-name-shadowing

2011-06-30 Thread GHC
#5288: Less noisy version of -fwarn-name-shadowing
-+--
Reporter:  batterseapower|   Owner:  
Type:  feature request   |  Status:  new 
Priority:  normal|   Component:  Compiler
 Version:  7.0.3 |Keywords:  
Testcase:|   Blockedby:  
  Os:  Unknown/Multiple  |Blocking:  
Architecture:  Unknown/Multiple  | Failure:  None/Unknown
-+--
Changes (by malcolm.wallace@…):

 * cc: malcolm.wallace@… (added)


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5288#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] #4359: Implement lambda-case/lambda-if

2011-06-30 Thread GHC
#4359: Implement lambda-case/lambda-if
-+--
Reporter:  batterseapower|Owner:  igloo   
Type:  feature request   |   Status:  patch   
Priority:  high  |Milestone:  7.4.1   
   Component:  Compiler  |  Version:  7.1 
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by simonpj):

 Thanks for rebasing.  The only issue here is one of syntax.  Several
 people have expressed anxiety about making so quiet a symbol as \ into a
 layout herald, and have showed that some existing code might break.

 So, what to do?  One possibility is ''not'' to make \ into a symbol
 introducing ''implicit'' layout, but still to allow ''explicit'' layout
 with braces and semi-colons.  Thus:
 {{{
\ { True - e1; False - e2 }
 }}}
 would be ok.  But this would not be ok
 {{{
 \ True - e1
   False - e2
 }}}
 That seems like a reasonable compromise.  Using the brace/semicolon stuff
 is compatible with the way case expressions work, which is a Good Thing.
 Any comments?

 Simon

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4359#comment:48
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] #5019: OS X: ld: warning: could not create compact unwind for _ffi_call_unix64

2011-06-30 Thread GHC
#5019: OS X: ld: warning: could not create compact unwind for _ffi_call_unix64
---+
Reporter:  altaic  |Owner:  igloo   
 
Type:  bug |   Status:  new 
 
Priority:  normal  |Milestone:  7.2.1   
 
   Component:  Compiler|  Version:  7.1 
 
Keywords:  | Testcase:  
 
   Blockedby:  |   Difficulty:  
 
  Os:  MacOS X | Blocking:  
 
Architecture:  x86_64 (amd64)  |  Failure:  Incorrect warning at 
compile-time
---+

Comment(by batterseapower):

 After I installed XCode4 I started getting lots of instances of this
 error:

 {{{
 ld: warning: could not create compact unwind for .LFB3: non-standard
 register 5 being saved in prolog
 }}}

 A validate run fails with:

 {{{
 Unexpected failures:
cabal/cabal01   cabal01 [bad stderr] (normal)
cabal/cabal04   cabal04 [bad stderr] (normal)
codeGen/should_compile  2578 [bad stderr] (normal)
driver  driver062a [bad stderr] (normal)
driver  driver062b [bad stderr] (normal)
driver  driver062c [bad stderr] (normal)
driver  driver062d [bad stderr] (normal)
driver  driver062e [bad stderr] (normal)
driver  driver081a [bad stderr] (normal)
driver  driver081b [bad stderr] (normal)
driver  rtsopts001 [bad stderr] (normal)
driver  rtsopts002 [bad stderr] (normal)
driver  withRtsOpts [bad stderr] (normal)
driver/1372 1372 [bad stderr] (normal)
driver/1959 1959 [bad stderr] (normal)
driver/T3007T3007 [bad stderr] (normal)
driver/recomp004recomp004 [bad stderr] (normal)
gadtgadt23 [bad stderr] (normal)
lib/IO  3307 [bad stderr] (normal)
lib/IO  T4113 [bad stdout] (normal)
lib/IO  environment001 [bad stderr] (normal)
module  mod179 [stderr mismatch] (normal)
perf/compiler   T4801 [stat not good enough] (normal)
perf/should_run T2902 [bad stderr] (normal)
perf/should_run T3736 [bad stderr] (normal)
programs/hs-booths-boot [stderr mismatch] (normal)
rename/prog006  rn.prog006 [bad stderr] (normal)
rts 4850 [bad stderr] (normal)
rts T4059 [bad stderr] (normal)
typecheck/bug1465   bug1465 [bad stderr] (normal)
 }}}

 These are almost all failing because of the extra warning text.

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

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


Re: [GHC] #3843: Merge plugins into HEAD

2011-06-30 Thread GHC
#3843: Merge plugins into HEAD
-+--
Reporter:  dreixel   |Owner:  simonpj 
Type:  task  |   Status:  new 
Priority:  normal|Milestone:  7.2.1   
   Component:  Compiler  |  Version:  6.13
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by batterseapower):

 simon: I've restored the home-package plugin support. This is basically
 just the ability to write:

 {{{
 {-# OPTIONS_GHC -fplugin Foo #-}
 module Bar
 ...
 }}}

 And then if you use ghc --make on Bar.hs Foo.hs, will be compiled if is
 not already. Have a look at e49dae36a00b2af8f6ad583dd24f9bacf5711242 if
 you want to see what is required.

 ~~~

 thoughtpolice: As I thought, linking is not working properly: see the
 newly-commited test plugins06. In this test, the plugin seqs the static
 flags, which provokes the error:

 {{{
 ghc-stage2: panic! (the 'impossible' happened)
   (GHC version 7.1.20110630 for i386-apple-darwin):
 Static flags have not been initialised!
 Please call GHC.newSession or GHC.parseStaticFlags early enough.

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

 This is because a new instance of the GHC package has been loaded, which
 does not have its staticFlags initialised since it does not share state
 with the initial copy.

 The fix is to do export-dynamic and change Linker.hs to get ghc package
 symbols from the current executable (which is what I did in my original
 patch), or use dynamic linking for the ghc package in which case
 everything will work.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3843#comment:32
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] #4359: Implement lambda-case/lambda-if

2011-06-30 Thread GHC
#4359: Implement lambda-case/lambda-if
-+--
Reporter:  batterseapower|Owner:  igloo   
Type:  feature request   |   Status:  patch   
Priority:  high  |Milestone:  7.4.1   
   Component:  Compiler  |  Version:  7.1 
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by mikhail.vorozhtsov):

 Replying to [comment:48 simonpj]:
  Thus:
  {{{
 \ { True - e1; False - e2 }
  }}}
  would be ok.  But this would not be ok
  {{{
  \ True - e1
False - e2
  }}}
  That seems like a reasonable compromise.  Using the brace/semicolon
 stuff is compatible with the way case expressions work, which is a Good
 Thing.  Any comments?

 Ugh. This is getting uglier and uglier. I've been using the current
 version of the patch for some time and I think the syntax has two major
 problems:

 1. It rejects the nice-looking indentation we are all used to in the
 single-clause case (see my 'mask' example above).

 2. It looks like a case expression, but has different pattern syntax, i.e.
 I constantly write
 {{{
 foo = \
   Nothing - ...
   Just a  - ...
 }}}
 instead of the correct
 {{{
 foo = \
   Nothing  - ...
   (Just a) - ...
 }}}

 Explicit layout solves the first issue, IMO, at the expense of graphic
 clarity. I mean
 {{{
 foo = \
   { Nothing  - do
   abc
   def
   ; (Just a) - do
   abc
   def
   }
 }}}
 just makes my eyes hurt. Do we really want a feature that is only
 accessible using explicit layout?

 I think the fact that single- and multi-clause lambdas require different
 indentation rules (and we can't look ahead to distinguish them) tells us
 to use a different token (\fn, \fun, \let?). I'd also say that {{{\x -
 case x of ...}}} (or {{{x - foo; case x of ...}}}) is such a common idiom
 that it deserves its anonymous counterpart (with respect to pattern
 syntax) regardless of the whole multi-clause lambda thing.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4359#comment:49
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] #4359: Implement lambda-case/lambda-if

2011-06-30 Thread GHC
#4359: Implement lambda-case/lambda-if
-+--
Reporter:  batterseapower|Owner:  igloo   
Type:  feature request   |   Status:  patch   
Priority:  high  |Milestone:  7.4.1   
   Component:  Compiler  |  Version:  7.1 
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by simonpj):

 Concerning (1) I don't understand. If you don't put a curly brace,
 everything would happen just like now... so `mask` would be fine.

 Concerning (2), yes, I am suggesting that this feature is only accessible
 using explicit layout.  It's not perfect, but the alternatives seem worse
 to me.

 Does anyone else have other ''concrete'' proposals?  If so, let's hear
 them.

 The default alternative is to do nothing.

 Simon

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

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


Re: [GHC] #3843: Merge plugins into HEAD

2011-06-30 Thread GHC
#3843: Merge plugins into HEAD
-+--
Reporter:  dreixel   |Owner:  simonpj 
Type:  task  |   Status:  new 
Priority:  normal|Milestone:  7.2.1   
   Component:  Compiler  |  Version:  6.13
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by simonpj):

 Great. If you two work it out, let me know what to commit.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/3843#comment:33
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] #4359: Implement lambda-case/lambda-if

2011-06-30 Thread GHC
#4359: Implement lambda-case/lambda-if
-+--
Reporter:  batterseapower|Owner:  igloo   
Type:  feature request   |   Status:  patch   
Priority:  high  |Milestone:  7.4.1   
   Component:  Compiler  |  Version:  7.1 
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by mikhail.vorozhtsov):

 Replying to [comment:50 simonpj]:
  Concerning (1) I don't understand. If you don't put a curly brace,
 everything would happen just like now... so `mask` would be fine.
 Yes. I was referring to the syntax implemented in the patch.

  Does anyone else have other ''concrete'' proposals?  If so, let's hear
 them.
 Let me bug you one last time. Please consider adding \case expressions
 ''in addition'' to multi-clause lambdas. Сase expressions are at the
 fingertips of every haskeller, not having their anonymous version will
 (and in my case already is) lead to constant stumbling (due to different
 pattern syntax). Besides, we already have that sort of duplication for
 one-argument named functions ({{{fun P = ...}}} vs {{{fun x = case x of P
 - ...}}}).

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4359#comment:51
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] #4359: Implement lambda-case/lambda-if

2011-06-30 Thread GHC
#4359: Implement lambda-case/lambda-if
-+--
Reporter:  batterseapower|Owner:  igloo   
Type:  feature request   |   Status:  patch   
Priority:  high  |Milestone:  7.4.1   
   Component:  Compiler  |  Version:  7.1 
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by simonmar):

 I don't like the explicit layout idea.  The goal so far has been to find a
 way to allow multi-clause multi-argument anonymous functions but without
 adding any inconsistencies to the language.  Having `\` introduce a layout
 context fits the bill, but unfortunately it breaks many common idioms.

 Perhaps the only way to do this is to have a new keyword.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/4359#comment:52
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] #5288: Less noisy version of -fwarn-name-shadowing

2011-06-30 Thread GHC
#5288: Less noisy version of -fwarn-name-shadowing
-+--
Reporter:  batterseapower|Owner:  
Type:  feature request   |   Status:  new 
Priority:  normal|Milestone:  
   Component:  Compiler  |  Version:  7.0.3   
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by simonpj):

 I don't understand what you mean by saying a definition shadows itself.

 And while I sometimes make silly loops too (of the form `x = ...x...`),
 they may or may not involve shadowing.

 Maybe you can write a more precise spec, and argue why it's useful?

 Simon

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5288#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] #5286: panic: getPredTyDescription EqPred [7.0 regression]

2011-06-30 Thread GHC
#5286: panic: getPredTyDescription EqPred [7.0 regression]
-+--
Reporter:  simonmar  |Owner:  simonpj   
Type:  bug   |   Status:  new   
Priority:  highest   |Milestone:  7.2.1 
   Component:  Compiler  |  Version:  7.0.3 
Keywords:| Testcase:
   Blockedby:|   Difficulty:
  Os:  Unknown/Multiple  | Blocking:
Architecture:  Unknown/Multiple  |  Failure:  Compile-time crash
-+--
Changes (by simonpj):

  * owner:  = simonpj


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5286#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] #5287: The 'impossible' happened. solveDerivEqns: probable loop

2011-06-30 Thread GHC
#5287: The 'impossible' happened.  solveDerivEqns: probable loop
---+
Reporter:  agocorona   |Owner:  simonpj   
Type:  bug |   Status:  new   
Priority:  normal  |Milestone:
   Component:  Compiler|  Version:  7.0.3 
Keywords:  solveDerivEqns  | Testcase:
   Blockedby:  |   Difficulty:
  Os:  Windows | Blocking:
Architecture:  x86 |  Failure:  Compile-time crash
---+
Changes (by simonpj):

  * owner:  = simonpj


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

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


Re: [GHC] #5288: Less noisy version of -fwarn-name-shadowing

2011-06-30 Thread GHC
#5288: Less noisy version of -fwarn-name-shadowing
-+--
Reporter:  batterseapower|Owner:  
Type:  feature request   |   Status:  new 
Priority:  normal|Milestone:  
   Component:  Compiler  |  Version:  7.0.3   
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by batterseapower):

 My thinking is that when I write:

 {{{
 foo rn = ... rn ...
   where
 rn = ... rn ...
 }}}

 My intention is almost invariably to bind a slightly-modified version of
 rn. However, in the code above I have made a mistake and reused the old
 name for the new version. What I should have written was:

 {{{
 foo rn = ... rn' ...
   where
 rn' = ... rn ...
 }}}

 The fact that the rn =  ... rn ... binding shadowed an existing binding
 called rn is the clue that I was trying to slightly-modify an existing
 binding. I don't want to warn if rn =  ... rn ... does not cause any
 shadowing because no such clue exists.

 Does that make more sense?

 I used to write programs with this error at the rate of perhaps 1 program
 per 20 hours of coding, but I'm getting better at avoiding it.

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

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


Re: [GHC] #5283: Arrow command combinators: addTickHsExpr explodes in GHCi

2011-06-30 Thread GHC
#5283: Arrow command combinators: addTickHsExpr explodes in GHCi
--+-
  Reporter:  peteg|  Owner:  
  Type:  bug  | Status:  closed  
  Priority:  normal   |  Milestone:  
 Component:  Compiler |Version:  7.0.3   
Resolution:  duplicate|   Keywords:  
  Testcase:  arrows/should_compile/T5283  |  Blockedby:  
Difficulty:   | Os:  Unknown/Multiple
  Blocking:   |   Architecture:  Unknown/Multiple
   Failure:  Compile-time crash   |  
--+-
Changes (by simonpj):

  * testcase:  = arrows/should_compile/T5283


-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5283#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] #5275: Data.Typeable not backwards compatible

2011-06-30 Thread GHC
#5275: Data.Typeable not backwards compatible
-+--
Reporter:  augustss  |Owner:  
Type:  bug   |   Status:  new 
Priority:  normal|Milestone:  
   Component:  libraries/base|  Version:  7.1 
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by simonpj):

 Simon and I talked about this.  We propose to change `Typeable.TyCon` from
 this:
 {{{
 data TyCon = TyCon !Key String
 }}}
 to this:
 {{{
 data TyCon = TyCon !Key
String-- Package name
String-- Module name
String-- TyCon name
 }}}
 and add accessors for these fields. Then you can get the bits you want.

 It's not enough to keep just the loacl name (like Integer) because there
 might be many types with the same name.

 A the same time we propose to get rid of the side-effected cache and use
 MD5 checksums instead.

-- 
Ticket URL: http://hackage.haskell.org/trac/ghc/ticket/5275#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] #5288: Less noisy version of -fwarn-name-shadowing

2011-06-30 Thread GHC
#5288: Less noisy version of -fwarn-name-shadowing
-+--
Reporter:  batterseapower|Owner:  
Type:  feature request   |   Status:  new 
Priority:  normal|Milestone:  
   Component:  Compiler  |  Version:  7.0.3   
Keywords:| Testcase:  
   Blockedby:|   Difficulty:  
  Os:  Unknown/Multiple  | Blocking:  
Architecture:  Unknown/Multiple  |  Failure:  None/Unknown
-+--

Comment(by simonpj):

 I'm still hoping for a *specification*.  Perhaps you mean report
 shadowing only for a recursive binding?

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

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


Quoting a quasi-quote

2011-06-30 Thread Yitzchak Gale
It was pointed out by Ben Millwood on the Cafe
that there is an undocumented way to escape the
closing oxford bracket of a quasi-quote using
a backslash:

[s|This quasi-quote contains this, \|], an escaped
closing oxford bracket.|]

The backslash itself cannot be escaped in this
way:

[s|Also contains an escaped bracket \\|] |]

Thus there is a fairly strong limitation on the
contents of a quasi-quote: it can never end
in a backslash.

This behavior is not mentioned in the GHC docs.
Is it a mistake, or is it meant to be a supported
feature?

This behavior is a bit surprising to me. Since the
whole point of a quasi-quoter is to allow the user
to define syntax, you would think that the syntax
for the quasi-quote itself would be as quiet as
possible and stay out of the way. People who
need to be able to escape the closing bracket
can easily define their own syntax to do so.

In any case, if this is indeed a feature, it certainly
should be documented.

Thanks,
Yitz

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


Re: [Haskell] ANNOUNCE: string-qq-0.0.2

2011-06-30 Thread Yitzchak Gale
Ben Millwood wrote:
 I once spent some time and energy making [foo| bar baz |\] quux |] do
 the right thing for a quasiquoter I implemented, only to discover that
 GHC already supports [foo| bar baz \|] quux |]. So yes, you can escape
 it.

Wow, that actually works.

That is very surprising, counter-intuitive, and undocumented.
Quasi-quotation is supposed to be a mechanism by which you can
define your own compile-time syntax. One would expect GHC to
stay out of the way as much as possible. People who need
some way to quote |] can define their own syntax for that.

And if that really is intended to be a supported feature, you
would certainly think it important enough to warrant a mention
in the GHC docs.

So even if this works, I wouldn't rely on it until we get confirmation
from the GHC team that it is indeed a supported a feature and won't
go away in some future version of GHC.

-Yitz

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


[Haskell] ANNOUNCING: Hac PDX II - A Portland Haskell Hackathon

2011-06-30 Thread Thomas DuBuisson
WHAT: A Haskell Hackathon

WHEN:
July 22-24 (Friday, Saturday, Sunday)
10:00 AM to 5:30 PM

WHERE:
Forth Avenue Building (FAB, 1900 SW 4th Ave) Room 10
Portland, Oregon 97201

WHERE, take 2:
FAB10 is a small auditorium just inside the west most Harrison Street entrance.

URL: http://haskell.org/haskellwiki/HacPDX-II

WHAT, take 2:
HacPDX-II is a Haskell Hackathon where beginners and experts alike can
come to work on the Haskell projects of their choice - individually or
in groups.  If you don't have a project then never fear, come and pick
one up or join a group (see the wiki for a list of projects).

EQUIPMENT:
You should bring a laptop with wireless (802.11). Ethernet is unavailable.

Registration:
Please RSVP by e-mailing thomas.dubuisson+hacpdx at gmail.com, as well
as add your name to the attendees Wiki page (see above URL).


Hope to see you there,
Thomas

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


[arch-haskell] AUR Comment for haskell-hdbc

2011-06-30 Thread AUR Feedback
from http://aur.archlinux.org/packages.php?ID=16103
federico_s wrote:

Dependencies haskell-bytestring=0.9.1.7, haskell-containers=0.3.0.0,
haskell-old-time=1.0.0.5, haskell-time=1.1.4 are obsolete.

---
If you no longer wish to receive notifications about this package,
please go the the above package page and click the UnNotify button.


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


[arch-haskell] AUR Comment for haskell-convertible

2011-06-30 Thread AUR Feedback
from http://aur.archlinux.org/packages.php?ID=23553
federico_s wrote:

Dependencies haskell-containers=0.3.0.0, haskell-old-time=1.0.0.5,
haskell-time=1.1.4 are obosolete.

---
If you no longer wish to receive notifications about this package,
please go the the above package page and click the UnNotify button.


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


[Haskell-cafe] what if two package contains same module?

2011-06-30 Thread 吴兴博
it seems that cabal install different into different folders.
if two package contains same module name, can they all exist?
since cabal have no remvoe or uninstall. how can I hide some packages?

Cheers!


吴兴博  Wu Xingbo

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


Re: [Haskell-cafe] what if two package contains same module?

2011-06-30 Thread Ivan Lazar Miljenovic
On 30 June 2011 17:40, 吴兴博 wux...@gmail.com wrote:
 it seems that cabal install different into different folders.
 if two package contains same module name, can they all exist?
 since cabal have no remvoe or uninstall. how can I hide some packages?

ghc-pkg hide foo-1.2.3

This will work for using them in ghci and explicit ghc calls.
Otherwise, when using packages built with cabal, you specify which
libraries you use and Cabal hides the rest.

-- 
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] what if two package contains same module?

2011-06-30 Thread Heinrich Apfelmus

吴兴博 wrote:

it seems that cabal install different into different folders.
if two package contains same module name, can they all exist?
since cabal have no remvoe or uninstall. how can I hide some packages?


The  ghc-pkg  program organizes GHC's package database. You want to run 
the command


ghc-pkg hide offending-package


Best regards,
Heinrich Apfelmus

--
http://apfelmus.nfshost.com


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


Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Holger Siegel

Am 29.06.2011 um 23:50 schrieb Philipp Schneider:

 Hi cafe,
 
 in my program i use a monad of the following type
 
 newtype M a = M (State - (a, State))
 
 i use the monad in two different ways. The type variable a can be a
 pair as in
 
 interp :: Term - Environment - M (Value,Environment)
 
 and it can be just a value as in
 
 type Environment = [(Name, Either Value (M Value))]

Simple rule: Never return an environment!

An environment contains local variable bindings, so no subcomputation will ever 
need to return its environment. I don't know anything about the language your 
program interprets, but I'm sure that you can rewrite function interp as

  interp :: Term - Environment - M Value

The structure of the interpreter will become clearer and your problem will 
vanish.


 
 now in any case when i print the monad, i just want to print the value
 and never the environment.
 
 More specific i want to use somthing like the following
 
 instance (Show a,Show b) = Show (M (a,b)) where
   show (M f) = let ((v,_), s) = f 0 in
 Value:  ++ show v ++   Count:  ++ show s
 
 instance Show a = Show (M a) where
   show (M f) = let (v, s) = f 0 in
 Value:  ++ show v ++   Count:  ++ show s
 
 however this gives me the following error message:
 
Overlapping instances for Show (M (Value, Environment))
  arising from a use of `print'
Matching instances:
  instance (Show a, Show b) = Show (M (a, b))
-- Defined at
 /home/phil/code/haskell/vorlesung/ue09/ue09-3c3.hs:78:10-42
  instance Show a = Show (M a)
-- Defined at
 /home/phil/code/haskell/vorlesung/ue09/ue09-3c3.hs:82:10-29
In a stmt of an interactive GHCi command: print it
 
 Any ideas how to fix it? Thanks!
 Philipp
 
 ___
 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] overloading show function

2011-06-30 Thread Wolfgang Braun
An environment contains local variable bindings, so no subcomputation will 
ever need to return its environment.
  - That is not true.  A subcomputation can possible modify an environment 
except the language forbids such a case.


On 06/30/2011 02:36 PM, Holger Siegel wrote:
 Am 29.06.2011 um 23:50 schrieb Philipp Schneider:

 Hi cafe,

 in my program i use a monad of the following type

 newtype M a = M (State - (a, State))

 i use the monad in two different ways. The type variable a can be a
 pair as in

 interp :: Term - Environment - M (Value,Environment)

 and it can be just a value as in

 type Environment = [(Name, Either Value (M Value))]
 Simple rule: Never return an environment!

 An environment contains local variable bindings, so no subcomputation will 
 ever need to return its environment. I don't know anything about the language 
 your program interprets, but I'm sure that you can rewrite function interp as

   interp :: Term - Environment - M Value

 The structure of the interpreter will become clearer and your problem will 
 vanish.


 now in any case when i print the monad, i just want to print the value
 and never the environment.

 More specific i want to use somthing like the following

 instance (Show a,Show b) = Show (M (a,b)) where
   show (M f) = let ((v,_), s) = f 0 in
 Value:  ++ show v ++   Count:  ++ show s

 instance Show a = Show (M a) where
   show (M f) = let (v, s) = f 0 in
 Value:  ++ show v ++   Count:  ++ show s

 however this gives me the following error message:

Overlapping instances for Show (M (Value, Environment))
  arising from a use of `print'
Matching instances:
  instance (Show a, Show b) = Show (M (a, b))
-- Defined at
 /home/phil/code/haskell/vorlesung/ue09/ue09-3c3.hs:78:10-42
  instance Show a = Show (M a)
-- Defined at
 /home/phil/code/haskell/vorlesung/ue09/ue09-3c3.hs:82:10-29
In a stmt of an interactive GHCi command: print it

 Any ideas how to fix it? Thanks!
 Philipp

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

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


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


[Haskell-cafe] Confused about my IterIO code

2011-06-30 Thread John Ky
Hi Hakell Cafe,

I'm struggling to understand my unambitious IterIO code that somehow manages
to work.

Basically I run an echo server that is supposed to read from a socket line
by line and write back to the socket with all the characters in the line
reversed:

import Control.Exception
import Control.Monad
import Control.Monad.Trans
import Data.IterIO
import Data.IterIO.Inum
import Network
import System.IO
import System.IO.Error (isEOFError)
import qualified Data.ByteString.Lazy as L
import qualified Data.ByteString.Lazy.Char8 as C

iterHandle' :: (MonadIO m) = Handle - IO (Iter L.ByteString m (), Onum
L.ByteString m a)
iterHandle' = iterHandle

main = withSocketsDo $ do
  sListen - listenOn (PortNumber 8000)
  putStrLn Listening on Port 8000
  forkIO $ forever $ do
(sSession, hostname, port) - accept sListen
hSetBuffering sSession NoBuffering
putStrLn (Connected to  ++ hostname ++ : ++ show port)
forkIO $ do
  (iter, enum) - iterHandle' sSession
  enum |$ inumReverseLines .| iter
  putStrLn Press CTRL-D to quit.
  exitOnCtrlD

inumReverseLines :: (Monad m) = Inum L.ByteString L.ByteString m a
inumReverseLines = mkInum $ do
  line - lineI
  return (L.reverse (L.concat [line, C.pack \n]))

exitOnCtrlD = try getLine = either
  (\e - unless (isEOFError e) $ ioError e)
  (const exitOnCtrlD)


When I run it, it does this:

asdfghc7@hoggy-nn:/home/hoggy$ nc localhost 8000
1234
4321
4321
1234
abcde
edcba


The red lines are the replies from my echo server.

But all I've done is:

enum |$ inumReverseLines .| iter

inumReverseLines = mkInum $ do
  line - lineI
  return (L.reverse (L.concat [line, C.pack \n]))


No attempt was made to reverse more than one line - at least as far as I can
see.  What have I done wrong that it should work so well?

Also, is there a better way to do this?

Cheers,

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


Re: [Haskell-cafe] Confused about my IterIO code

2011-06-30 Thread Brandon Allbery
On Thu, Jun 30, 2011 at 09:53, John Ky newho...@gmail.com wrote:
 enum |$ inumReverseLines .| iter
 inumReverseLines = mkInum $ do
   line - lineI
   return (L.reverse (L.concat [line, C.pack \n]))

 No attempt was made to reverse more than one line - at least as far as I can
 see.  What have I done wrong that it should work so well?

An iterator that doesn't iterate isn't very useful.

-- 
brandon s allbery                                      allber...@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms

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


Re: [Haskell-cafe] Confused about my IterIO code

2011-06-30 Thread dm-list-haskell-cafe
At Thu, 30 Jun 2011 23:53:02 +1000,
John Ky wrote:
 
 But all I've done is:
 
 enum |$ inumReverseLines .| iter

 inumReverseLines = mkInum $ do
   line - lineI
   return (L.reverse (L.concat [line, C.pack \n]))

mkInum repeatedly invokes its iter argument so as to keep producing
chunks.  If you want to reverse only one line, it might be easiest to
use something along the lines of:

mkInumM $ do
  line - lineI
  ifeed (L.reverse (L.concat [line, C.pack \n]))

mkInumM is a more manual Inum construction function that doesn't
automatically do things like loop or handle EOF conditions.

David

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


Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Philipp Schneider
On 06/30/2011 02:36 PM, Holger Siegel wrote:
 Am 29.06.2011 um 23:50 schrieb Philipp Schneider:

 Hi cafe,

 in my program i use a monad of the following type

 newtype M a = M (State - (a, State))

 i use the monad in two different ways. The type variable a can be a
 pair as in

 interp :: Term - Environment - M (Value,Environment)

 and it can be just a value as in

 type Environment = [(Name, Either Value (M Value))]
 Simple rule: Never return an environment!

 An environment contains local variable bindings, so no subcomputation will 
 ever need to return its environment. I don't know anything about the language 
 your program interprets, but I'm sure that you can rewrite function interp as

   interp :: Term - Environment - M Value

 The structure of the interpreter will become clearer and your problem will 
 vanish.

Hello Holger,

I'm giving two lambda interpreters. The first one is a call by value
interpreter, the second one a call by name interpreter which are
described in Philip Wadler's paper The essence of functional
programming page 4 and 12. Now my task is to write a lazy lambda
interpreter. The exercise is more playful than serious since Wadler's
call by value interpreter is, since written in lazy Haskell, already a
lazy lambda interpreter. (To get true call by value one would need to
force evaluations of the arguments with the seq function.)
For both of Wadler's interpreters the type of the interpertation
function is:
interp :: Term - Environment - M Value

Now to simulate lazy interpretation i need to do the following: Decide
is the value I need already evaluated or is it still a computation. In
the later case I need to evaluate it and save its value in the
environment. This is the reason I changed the type of the interpretation
function to:
interp :: Term - Environment - M (Value,Environment)

I appened my full interpreter. If you can find a more elegant way to
save the newly interpreted values, you are more than welcome to show my
how to do it.

Cheers,
Philipp


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


Re: [Haskell-cafe] what if two package contains same module?

2011-06-30 Thread Ertugrul Soeylemez
吴兴博 wux...@gmail.com wrote:

 it seems that cabal install different into different folders.  if two
 package contains same module name, can they all exist?  since cabal
 have no remvoe or uninstall. how can I hide some packages?

Alternatively for small programs for which you don't use a Cabal file
you can use the PackageImports extension (-XPackageImports) and import
modules from specific packages.  For example both the 'pool' and the
'resource-pool' packages provide a Data.Pool module.  You can choose to
import the one from 'resource-pool' using this:

import resource-pool Data.Pool


Greets,
Ertugrul


-- 
nightmare = unsafePerformIO (getWrongWife = sex)
http://ertes.de/



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


Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Philipp Schneider
On 06/30/2011 08:25 PM, Philipp Schneider wrote:
 On 06/30/2011 02:36 PM, Holger Siegel wrote:
 Am 29.06.2011 um 23:50 schrieb Philipp Schneider:

 Hi cafe,

 in my program i use a monad of the following type

 newtype M a = M (State - (a, State))

 i use the monad in two different ways. The type variable a can be a
 pair as in

 interp :: Term - Environment - M (Value,Environment)

 and it can be just a value as in

 type Environment = [(Name, Either Value (M Value))]
 Simple rule: Never return an environment!

 An environment contains local variable bindings, so no subcomputation will 
 ever need to return its environment. I don't know anything about the 
 language your program interprets, but I'm sure that you can rewrite function 
 interp as

   interp :: Term - Environment - M Value

 The structure of the interpreter will become clearer and your problem will 
 vanish.

 Hello Holger,

 I'm giving two lambda interpreters. The first one is a call by value
 interpreter, the second one a call by name interpreter which are
 described in Philip Wadler's paper The essence of functional
 programming page 4 and 12. Now my task is to write a lazy lambda
 interpreter. The exercise is more playful than serious since Wadler's
 call by value interpreter is, since written in lazy Haskell, already a
 lazy lambda interpreter. (To get true call by value one would need to
 force evaluations of the arguments with the seq function.)
 For both of Wadler's interpreters the type of the interpertation
 function is:
 interp :: Term - Environment - M Value

 Now to simulate lazy interpretation i need to do the following: Decide
 is the value I need already evaluated or is it still a computation. In
 the later case I need to evaluate it and save its value in the
 environment. This is the reason I changed the type of the interpretation
 function to:
 interp :: Term - Environment - M (Value,Environment)

 I appened my full interpreter. If you can find a more elegant way to
 save the newly interpreted values, you are more than welcome to show my
 how to do it.

 Cheers,
 Philipp
I forgot to add the interpreter.
{-# LANGUAGE OverlappingInstances #-}

import Prelude hiding (lookup, fail)

import Control.Monad
   
-- Basiswerte

data Value= WrongAd
  | WrongAp
  | WrongL
  | Num Int
  | Fun (Either Value (M Value) - M Value)

instance Show Value where
   show WrongAd= wrong add  
   show WrongAp= wrong app 
   show WrongL= wrong lookup   
   show (Num i)  = show i
   show (Fun f)  = function

-- Terme 

data Term = Var Name
  | Con Int
  | Add Term Term
  | Lam Name Term
  | App Term Term deriving Show

-- Interpretation der Terme (Lazy evaluation)

interp :: Term - Environment - M (Value,Environment)
interp (Var x) e   = lookup x e
interp (Con i) e   = return (Num i,e)
interp (Add u v) e =  do
  (a,e) - interp u e
  (b,e) - interp v e
  s - add a b
  return (s,e)
interp (Lam x v) e  = return (Fun (\m - (interp v ((x, m):e)) = return . fst) , e)
interp (App t u) e  = do
  (f,e) - interp t e
  a - (apply f (Right ((interp u e) = return . fst)))
  return (a,e)


add :: Value - Value - M Value
add (Num i) (Num j) = tick = (\() - return (Num (i+j)))
add a b = return WrongAd

apply :: Value - Either Value (M Value) - M Value
apply (Fun k) a= tick = (\() - k a)
apply notFun a = return WrongAp

-- Umgebung

type Environment = [(Name, Either Value (M Value))]
type Name = String

lookup :: Name - Environment - M (Value,Environment)
lookup x eComplete = lookup_h x eComplete
  where
lookup_h x []= return (WrongL,[])
lookup_h x e@((y,b):etl) = 
  if x==y then case b of 
-- schon ausgewertet
Left a - return (a,e) 
-- noch nicht ausgewertet (speichere den ausgewerteten Wert)
Right a - (a = (\x- return (x, (y,Left x):eComplete)))
  else lookup_h x etl

-- Lazy-Interpreter zaehlt die Reduktionen (Wadler: Beispiel 9)

type State = Int

newtype M a = M (State - (a, State))

tick = M (\s - ((), s+1))


instance (Show a,Show b) = Show (M (a,b)) where
   show (M f) = let ((v,_), s) = f 0 in
 Value:  ++ show v ++   Count:  ++ show s

instance Show a = Show (M a) where
   show (M f) = let (v, s) = f 0 in
 Value:  ++ show v ++   Count:  ++ show s


instance Monad M where
   return a = M (\s - (a, s))
   (M m) = k = M (\s0 - let (a, s1) = m s0
   (M m')  = k a
   in m' s1
  ) 
   fail s = error s -- wird nicht aufgerufen
   
-- Beispiele:

-- test :: Term - String
test t = (interp t [])

term0 = (Con 10)
term0' = (Var x)
term1 = (Add (Con 10) (Con 11))
term2 = (Lam x (Add (Var x) (Con 10)))
term3 = (App term2 (Con 11))
term4 = (Lam x (Add (Var x) (Var x)))
term5 = (App term4 term1)
term6 = (Lam x (Lam y (Add (Var x) (Var y
term7 = (App term6 (Con 10))
term8 = 

[Haskell-cafe] ANNOUNCE: mime-mail-ses 0.0.0

2011-06-30 Thread Michael Snoyman
Hi all,

I'd like to announce the first release of mime-mail-ses[1]. This
provides easy integration between the mime-mail package[2] and
Amazon's Simple Email Service. This package was written for the
Haskellers website[3], purely because I despise setting up mail
servers.

There aren't many more features planned, though hopefully in the
future it will integrate more closely with Aristid's aws package[4].
Also, a big thank you to Thomas DuBuisson for crypto-api[5] and
Vincent Hanquez for cryptohash[6]. Those two packages make it very
easy to write applications that require cryptographic authentication.

Michael

[1] http://hackage.haskell.org/package/mime-mail-ses
[2] http://hackage.haskell.org/package/mime-mail
[3] http://www.haskellers.com/
[4] http://hackage.haskell.org/package/aws
[5] http://hackage.haskell.org/package/crypto-api
[6] http://hackage.haskell.org/package/cryptohash

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


Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Holger Siegel

Am 30.06.2011 um 20:23 schrieb Philipp Schneider:

 On 06/30/2011 02:36 PM, Holger Siegel wrote:
 Am 29.06.2011 um 23:50 schrieb Philipp Schneider:
 
 Hi cafe,
 
 in my program i use a monad of the following type
 
 newtype M a = M (State - (a, State))
 
 i use the monad in two different ways. The type variable a can be a
 pair as in
 
 interp :: Term - Environment - M (Value,Environment)
 
 and it can be just a value as in
 
 type Environment = [(Name, Either Value (M Value))]
 Simple rule: Never return an environment!
 
 An environment contains local variable bindings, so no subcomputation will 
 ever need to return its environment. I don't know anything about the 
 language your program interprets, but I'm sure that you can rewrite function 
 interp as
 
  interp :: Term - Environment - M Value
 
 The structure of the interpreter will become clearer and your problem will 
 vanish.
 
 Hello Holger,
 
 I'm giving two lambda interpreters. The first one is a call by value
 interpreter, the second one a call by name interpreter which are
 described in Philip Wadler's paper The essence of functional
 programming page 4 and 12. Now my task is to write a lazy lambda
 interpreter. The exercise is more playful than serious since Wadler's
 call by value interpreter is, since written in lazy Haskell, already a
 lazy lambda interpreter. (To get true call by value one would need to
 force evaluations of the arguments with the seq function.)

Hello Philipp,

that's a nice exercise.

 For both of Wadler's interpreters the type of the interpertation
 function is:
 interp :: Term - Environment - M Value
 
 Now to simulate lazy interpretation i need to do the following: Decide
 is the value I need already evaluated or is it still a computation. In
 the later case I need to evaluate it and save its value in the
 environment. This is the reason I changed the type of the interpretation
 function to:
 interp :: Term - Environment - M (Value,Environment)

But that won't work: After you have evaluated an entry of the environment, you 
store the resulting value but you throw away its updated environment. That 
means, you lose the results of all subcomputations instead of propagating them 
to all other copies of the environment. Consider the following expression:

let x = big_computation in let y = x in y + x

First, big_computation is bound to the name x, resulting in an environment 
[(x, big_computation)]. Then a closure consisting of this environment 
together with the right hand side 'x' is bound to the name y. Now y+x is 
evaluated: The closure is entered, and from its environment the content of x - 
a call to big_computation - is looked up. Now big_computation is evaluated and 
the result is bound to x in this environment. After that, this result is also 
returned as the value of y. But when returning from the evaluation of y, the 
environment with the updated value of x is lost and you have to re-evaluate it 
in order to calculate x+y!

And that is why I say never return an environment. It is either wrong or 
unnecessary or the resulting semantics of the interpreter is hard to comprehend.

In order to implement lazy evaluation correctly, you have to maintain some 
global state in which the thunks are updated. For example, your environment 
could bind IORefs that contain unevaluated thunks to variable names and update 
them when the thunk is evaluated. But then your interpreter has to run in the 
IO monad.

By the way, do you already know Peter Sestoft's paper Deriving a lazy abstract 
machine?

Cheers, Holger


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


[Haskell-cafe] ANNOUNCING: Hac PDX II - A Portland Haskell Hackathon

2011-06-30 Thread Thomas DuBuisson
WHAT: A Haskell Hackathon

WHEN:
July 22-24 (Friday, Saturday, Sunday)
10:00 AM to 5:30 PM

WHERE:
Forth Avenue Building (FAB, 1900 SW 4th Ave) Room 10
Portland, Oregon 97201

WHERE, take 2:
FAB10 is a small auditorium just inside the west most Harrison Street entrance.

URL: http://haskell.org/haskellwiki/HacPDX-II

WHAT, take 2:
HacPDX-II is a Haskell Hackathon where beginners and experts alike can
come to work on the Haskell projects of their choice - individually or
in groups.  If you don't have a project then never fear, come and pick
one up or join a group (see the wiki for a list of projects).

EQUIPMENT:
You should bring a laptop with wireless (802.11). Ethernet is unavailable.

Registration:
Please RSVP by e-mailing thomas.dubuisson+hacpdx at gmail.com, as well
as add your name to the attendees Wiki page (see above URL).


Hope to see you there,
Thomas

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


Re: [Haskell-cafe] ANNOUNCING: Hac PDX II - A Portland Haskell Hackathon

2011-06-30 Thread Alexander Solla
On Thu, Jun 30, 2011 at 12:55 PM, Thomas DuBuisson 
thomas.dubuis...@gmail.com wrote:

 WHAT: A Haskell Hackathon

 WHEN:
 July 22-24 (Friday, Saturday, Sunday)
 10:00 AM to 5:30 PM

 WHERE:
 Forth Avenue Building (FAB, 1900 SW 4th Ave) Room 10
 Portland, Oregon 97201
 ...
 Registration:
 Please RSVP by e-mailing thomas.dubuisson+hacpdx at gmail.com, as well
 as add your name to the attendees Wiki page (see above URL).



Is anybody from the Eugene area considering going?  We could organize a
carpool.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Philipp Schneider
On 06/30/2011 09:49 PM, Holger Siegel wrote:
 Am 30.06.2011 um 20:23 schrieb Philipp Schneider:

 On 06/30/2011 02:36 PM, Holger Siegel wrote:
 Am 29.06.2011 um 23:50 schrieb Philipp Schneider:

 Hi cafe,

 in my program i use a monad of the following type

 newtype M a = M (State - (a, State))

 i use the monad in two different ways. The type variable a can be a
 pair as in

 interp :: Term - Environment - M (Value,Environment)

 and it can be just a value as in

 type Environment = [(Name, Either Value (M Value))]
 Simple rule: Never return an environment!

 An environment contains local variable bindings, so no subcomputation will 
 ever need to return its environment. I don't know anything about the 
 language your program interprets, but I'm sure that you can rewrite 
 function interp as

  interp :: Term - Environment - M Value

 The structure of the interpreter will become clearer and your problem will 
 vanish.

 Hello Holger,

 I'm giving two lambda interpreters. The first one is a call by value
 interpreter, the second one a call by name interpreter which are
 described in Philip Wadler's paper The essence of functional
 programming page 4 and 12. Now my task is to write a lazy lambda
 interpreter. The exercise is more playful than serious since Wadler's
 call by value interpreter is, since written in lazy Haskell, already a
 lazy lambda interpreter. (To get true call by value one would need to
 force evaluations of the arguments with the seq function.)
 Hello Philipp,

 that's a nice exercise.

 For both of Wadler's interpreters the type of the interpertation
 function is:
 interp :: Term - Environment - M Value

 Now to simulate lazy interpretation i need to do the following: Decide
 is the value I need already evaluated or is it still a computation. In
 the later case I need to evaluate it and save its value in the
 environment. This is the reason I changed the type of the interpretation
 function to:
 interp :: Term - Environment - M (Value,Environment)
 But that won't work: After you have evaluated an entry of the environment, 
 you store the resulting value but you throw away its updated environment. 
 That means, you lose the results of all subcomputations instead of 
 propagating them to all other copies of the environment. Consider the 
 following expression:

 let x = big_computation in let y = x in y + x

 First, big_computation is bound to the name x, resulting in an environment 
 [(x, big_computation)]. Then a closure consisting of this environment 
 together with the right hand side 'x' is bound to the name y. Now y+x is 
 evaluated: The closure is entered, and from its environment the content of x 
 - a call to big_computation - is looked up. Now big_computation is evaluated 
 and the result is bound to x in this environment. After that, this result is 
 also returned as the value of y. But when returning from the evaluation of y, 
 the environment with the updated value of x is lost and you have to 
 re-evaluate it in order to calculate x+y!
Hello Holger,

Can you give me an example of a lambda term in which this would be an issue?
Evaluating the following works just fine in my implementation.
interp (App (Lam x (Add (Var x) (Var x))) big_computation) []
When the first variable x is evaluated my interp function returns the
value and the updated environment. Then to evaluate the second variable
the value is just looked up from this environment.
Of course in the following big_computation would be evaluated twice
(App (Lam x (App (Lam y (Add (Var x) (Var y))) big_computation))
big_computation)
But i simply don't have a concept like let x=y.
 And that is why I say never return an environment. It is either wrong or 
 unnecessary or the resulting semantics of the interpreter is hard to 
 comprehend.

 In order to implement lazy evaluation correctly, you have to maintain some 
 global state in which the thunks are updated. For example, your environment 
 could bind IORefs that contain unevaluated thunks to variable names and 
 update them when the thunk is evaluated. But then your interpreter has to run 
 in the IO monad.
I agree that this would  be the proper way to do it, but I was trying
to minimize the use of monads since they have just been introduced in
the course.
 By the way, do you already know Peter Sestoft's paper Deriving a lazy 
 abstract machine?
I haven't read is so far, but thanks for pointing it out.
 Cheers, Holger

Cheers,
Philipp

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


Re: [Haskell-cafe] overloading show function

2011-06-30 Thread Holger Siegel

Am 30.06.2011 um 22:57 schrieb Philipp Schneider:

 On 06/30/2011 09:49 PM, Holger Siegel wrote:
 (...) But that won't work: After you have evaluated an entry of the 
 environment, you store the resulting value but you throw away its updated 
 environment. That means, you lose the results of all subcomputations instead 
 of propagating them to all other copies of the environment. Consider the 
 following expression:
 
 let x = big_computation in let y = x in y + x
 
 First, big_computation is bound to the name x, resulting in an environment 
 [(x, big_computation)]. Then a closure consisting of this environment 
 together with the right hand side 'x' is bound to the name y. Now y+x is 
 evaluated: The closure is entered, and from its environment the content of x 
 - a call to big_computation - is looked up. Now big_computation is evaluated 
 and the result is bound to x in this environment. After that, this result is 
 also returned as the value of y. But when returning from the evaluation of 
 y, the environment with the updated value of x is lost and you have to 
 re-evaluate it in order to calculate x+y!
 Hello Holger,
 
 Can you give me an example of a lambda term in which this would be an issue?
 Evaluating the following works just fine in my implementation.
 interp (App (Lam x (Add (Var x) (Var x))) big_computation) []
 When the first variable x is evaluated my interp function returns the
 value and the updated environment. Then to evaluate the second variable
 the value is just looked up from this environment.
 Of course in the following big_computation would be evaluated twice
 (App (Lam x (App (Lam y (Add (Var x) (Var y))) big_computation))
 big_computation)
 But i simply don't have a concept like let x=y.


 App (Lam x (App (Lam y (Add (Var y) (Var x))) (Var x ))) (Con 2)

takes three reduction steps, which is correct, but

 App (Lam x (App (Lam y (Add (Var y) (Var x))) (Var x ))) (Add (Con 
1)(Con 1))

takes five reduction steps although it should take only four.


 And that is why I say never return an environment. It is either wrong or 
 unnecessary or the resulting semantics of the interpreter is hard to 
 comprehend.
 
 In order to implement lazy evaluation correctly, you have to maintain some 
 global state in which the thunks are updated. For example, your environment 
 could bind IORefs that contain unevaluated thunks to variable names and 
 update them when the thunk is evaluated. But then your interpreter has to 
 run in the IO monad.
 I agree that this would  be the proper way to do it, but I was trying
 to minimize the use of monads since they have just been introduced in
 the course.

That shouldn't be too hard. Just change your definition of monad M to

 newtype M a = M (State - IO (a, State))

and define the corresponding monad instance as an exercise :) (or ask me by 
private mail if you like).


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


[Haskell-cafe] Printing the empty list.

2011-06-30 Thread Joshua Ball
GHCi seems to be clever about some things:

If I try to print the empty list in ghci, I encounter no problems:

Prelude []
[]
Prelude show []
[]
Prelude print []
[]

Even though the type of the list is clearly unknown, it must be
picking SOME type. (why does it print [] instead of )?

If I write a program in a file and load it in

main = print []

Then I get the ambiguous type variable error that I would expect. Why
doesn't ghci generate this error at the prompt?

-- 
Borrow my books: http://goo.gl/UBbSH

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


Re: [Haskell-cafe] Printing the empty list.

2011-06-30 Thread Brandon Allbery
On Thu, Jun 30, 2011 at 18:58, Joshua Ball joshbb...@gmail.com wrote:
 GHCi seems to be clever about some things:

GHCi uses extended defaulting rules unless told otherwise, so in the
absence of anything else it uses () as the type.  You can enable this
in GHC as well, with -XExtendedDefaultRules.  See
http://www.haskell.org/ghc/docs/latest/html/users_guide/interactive-evaluation.html#extended-default-rules

-- 
brandon s allbery                                      allber...@gmail.com
wandering unix systems administrator (available)     (412) 475-9364 vm/sms

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


Re: [Haskell-cafe] Printing the empty list.

2011-06-30 Thread Ivan Lazar Miljenovic
On 1 July 2011 08:58, Joshua Ball joshbb...@gmail.com wrote:
 GHCi seems to be clever about some things:

 If I try to print the empty list in ghci, I encounter no problems:

 Prelude []
 []
 Prelude show []
 []
 Prelude print []
 []

 Even though the type of the list is clearly unknown, it must be
 picking SOME type. (why does it print [] instead of )?

Type defaulting: if you don't specify a type, then ghci makes it [Integer].

 If I write a program in a file and load it in

 main = print []

 Then I get the ambiguous type variable error that I would expect. Why
 doesn't ghci generate this error at the prompt?

Because ghc doesn't do type defaulting.

-- 
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] overloading show function

2011-06-30 Thread Philipp Schneider
On 06/30/2011 11:46 PM, Holger Siegel wrote:
 Am 30.06.2011 um 22:57 schrieb Philipp Schneider:

 On 06/30/2011 09:49 PM, Holger Siegel wrote:
 (...) But that won't work: After you have evaluated an entry of the 
 environment, you store the resulting value but you throw away its updated 
 environment. That means, you lose the results of all subcomputations 
 instead of propagating them to all other copies of the environment. 
 Consider the following expression:

 let x = big_computation in let y = x in y + x

 First, big_computation is bound to the name x, resulting in an environment 
 [(x, big_computation)]. Then a closure consisting of this environment 
 together with the right hand side 'x' is bound to the name y. Now y+x is 
 evaluated: The closure is entered, and from its environment the content of 
 x - a call to big_computation - is looked up. Now big_computation is 
 evaluated and the result is bound to x in this environment. After that, 
 this result is also returned as the value of y. But when returning from the 
 evaluation of y, the environment with the updated value of x is lost and 
 you have to re-evaluate it in order to calculate x+y!
 Hello Holger,

 Can you give me an example of a lambda term in which this would be an issue?
 Evaluating the following works just fine in my implementation.
 interp (App (Lam x (Add (Var x) (Var x))) big_computation) []
 When the first variable x is evaluated my interp function returns the
 value and the updated environment. Then to evaluate the second variable
 the value is just looked up from this environment.
 Of course in the following big_computation would be evaluated twice
 (App (Lam x (App (Lam y (Add (Var x) (Var y))) big_computation))
 big_computation)
 But i simply don't have a concept like let x=y.

  App (Lam x (App (Lam y (Add (Var y) (Var x))) (Var x ))) (Con 2)

 takes three reduction steps, which is correct, but

  App (Lam x (App (Lam y (Add (Var y) (Var x))) (Var x ))) (Add (Con 
 1)(Con 1))

 takes five reduction steps although it should take only four.
Ok, I now see the problem. Thanks for pointing it out to me.

 And that is why I say never return an environment. It is either wrong or 
 unnecessary or the resulting semantics of the interpreter is hard to 
 comprehend.

 In order to implement lazy evaluation correctly, you have to maintain some 
 global state in which the thunks are updated. For example, your environment 
 could bind IORefs that contain unevaluated thunks to variable names and 
 update them when the thunk is evaluated. But then your interpreter has to 
 run in the IO monad.
 I agree that this would  be the proper way to do it, but I was trying
 to minimize the use of monads since they have just been introduced in
 the course.
 That shouldn't be too hard. Just change your definition of monad M to

  newtype M a = M (State - IO (a, State))

 and define the corresponding monad instance as an exercise :) (or ask me by 
 private mail if you like).
I'll try to implement it tomorrow. Hopefully I'll succeed without your
help. ;)


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


Re: [Haskell-cafe] Printing the empty list.

2011-06-30 Thread Brent Yorgey
On Fri, Jul 01, 2011 at 09:05:05AM +1000, Ivan Lazar Miljenovic wrote:
 On 1 July 2011 08:58, Joshua Ball joshbb...@gmail.com wrote:
  GHCi seems to be clever about some things:
 
  If I try to print the empty list in ghci, I encounter no problems:
 
  Prelude []
  []
  Prelude show []
  []
  Prelude print []
  []
 
  Even though the type of the list is clearly unknown, it must be
  picking SOME type. (why does it print [] instead of )?
 
 Type defaulting: if you don't specify a type, then ghci makes it
 [Integer].

In this case I'm pretty sure it is [()] since there is only a Show
constraint.  If there were a Num constraint it would pick
Integer.

  Prelude sum []
  0
  Prelude :t it
  it :: Integer

-Brent

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


Re: [Haskell-cafe] Printing the empty list.

2011-06-30 Thread Ivan Lazar Miljenovic
On 1 July 2011 11:35, Brent Yorgey byor...@seas.upenn.edu wrote:
 On Fri, Jul 01, 2011 at 09:05:05AM +1000, Ivan Lazar Miljenovic wrote:
 On 1 July 2011 08:58, Joshua Ball joshbb...@gmail.com wrote:
  GHCi seems to be clever about some things:
 
  If I try to print the empty list in ghci, I encounter no problems:
 
  Prelude []
  []
  Prelude show []
  []
  Prelude print []
  []
 
  Even though the type of the list is clearly unknown, it must be
  picking SOME type. (why does it print [] instead of )?

 Type defaulting: if you don't specify a type, then ghci makes it
 [Integer].

 In this case I'm pretty sure it is [()] since there is only a Show
 constraint.  If there were a Num constraint it would pick
 Integer.

Yeah, I forgot about ()

-- 
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] Patterns for processing large but finite streams

2011-06-30 Thread Eugene Kirpichov
Hi,

I'm rewriting timeplot to avoid holding the whole input in memory, and
naturally a problem arises:

How to represent large but finite streams and functions that process
them, returning other streams or some kinds of aggregate values?

Examples:
* Adjacent differences of a stream of numbers
* Given a stream of numbers with times, split it into buckets by time
of given width and produce a stream of (bucket, 50%,75% and 90%
quantiles in this bucket)
* Sum a stream of numbers

Is this, perhaps, what comonads are for? Or iteratees?

-- 
Eugene Kirpichov
Principal Engineer, Mirantis Inc. http://www.mirantis.com/
Editor, http://fprog.ru/

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


[Haskell-cafe] How to implement the mean function

2011-06-30 Thread Ruohao Li
Hi guys,

I just started learning some Haskell. I want to implement a mean function to
compute the mean of a list. The signature of the function is:
mean :: (Num a, Fractional b) = [a] - b
But when I implement this simple function, the compiler keep whining at me
on type errors. I know this is wrong:
mean xs = sum xs / length xs
But how to get it right? Thanks.
___
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe


[arch-haskell] AUR Out-of-date Notification for haskell-ghc-syb-utils

2011-06-30 Thread AUR Feedback
Your package haskell-ghc-syb-utils has been flagged out of date by
federico_s [1]. You may view your package at:
http://aur.archlinux.org/packages.php?ID=37650

[1] - http://aur.archlinux.org/account.php?Action=AccountInfoID=29078


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