Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-28 Thread Magicloud Magiclouds
Sorry for the wrong information. I made a mistake when did the test.
After more testing, I think it is a bug of ghc 7.4.1. Until now, I
cannot find a way to make ghc 7.4.1 compiled binary work.

On Mon, May 28, 2012 at 11:01 AM, Magicloud Magiclouds
magicloud.magiclo...@gmail.com wrote:
 Alright, with another box of different version of ghc and things. I
 finally got the cause.
 Or may I say as simple as Ozgun said, ghc 7.4.1 defaultly uses
 optimization. ghc-7.4.1 -O0 works. ghc-7.2.2 also works.

 Thank you all.

 On Sun, May 27, 2012 at 7:07 PM, Chris Dornan ch...@chrisdornan.com wrote:
 By configuration of the OpenLDAP client library I mean mostly so that SSL 
 connections will work, but this is all system-level configuration.

 That GHC establishes connections in interactive mode for you indicates that 
 the problem is not with the LDAP systems, but that something peculiar is 
 going wrong with your GHC installation.

 Do you have only the one GHC installation on the system; is there any chance 
 that ghc and ghci could be selecting different installations?

 Is it easy for you to try connecting with GHC-7.0.4? It would be worth a try 
 if you can -- it might be a 7.4.1 oddity but it looks as if it could be some 
 kind of GHC mis-installation.

 (If trying this with GHC-7.0.4 would be bothersome I would be interested to 
 hear more; which O/S are you using?)

 Chris

 -Original Message-
 From: Magicloud Magiclouds [mailto:magicloud.magiclo...@gmail.com]
 Sent: 27 May 2012 10:12
 To: Chris Dornan
 Cc: Brandon Allbery; Haskell-Cafe
 Subject: Re: [Haskell-cafe] What is the difference between runhaskell and 
 compile?

 Hi,
  Sorry for the delayed reply. I am using ghc 7.4.1 and LDAP 0.6.6.
  When you said configuration of the OpenLDAP client library, may I have 
 more information? Since ldap-utils and other client (php, perl,
 etc) do not have any problem. This might be the only clue to me.

 On Fri, May 25, 2012 at 4:43 PM, Chris Dornan ch...@chrisdornan.com wrote:
 I have been using LDAP with GHC without a problem – I get this error
 often but the problems have been with the configuration of the
 OpenLDAP client library or the OpenLDAP server.



 We are all taking about LDAP-0.6.6? Which version of GHC are we
 talking about? (I don’t think I have tested this on GHC-7.4.1, and
 maybe the others haven’t either.)



 Chris





 From: haskell-cafe-boun...@haskell.org
 [mailto:haskell-cafe-boun...@haskell.org] On Behalf Of Brandon Allbery
 Sent: 25 May 2012 04:21
 To: Magicloud Magiclouds
 Cc: Haskell-Cafe
 Subject: Re: [Haskell-cafe] What is the difference between runhaskell
 and compile?



 On Thu, May 24, 2012 at 11:05 PM, Magicloud Magiclouds
 magicloud.magiclo...@gmail.com wrote:

 Hi there,
  The code could not be simpler. Just ldapInit, ldapSimpleBind.
  I just found that the code works with ghci, too. So to sum up,
 ghci/runhaskell works, ghc not.



 A possibility that occurs to me:  does it by any chance work with ghc
 -threaded?  Perhaps the issue relates to the different behavior of the
 threaded runtime (which is used automatically by ghci/runghc).



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



 --
 竹密岂妨流水过
 山高哪阻野云飞

 And for G+, please use magiclouds#gmail.com.




 --
 竹密岂妨流水过
 山高哪阻野云飞

 And for G+, please use magiclouds#gmail.com.



-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

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


Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-28 Thread Chris Dornan

 Sorry for the wrong information. I made a mistake when did the test.
 After more testing, I think it is a bug of ghc 7.4.1. Until now, I cannot 
 find a way to make ghc 7.4.1 compiled binary work.

It sounds like this should be looked at further. Somebody should verify try to 
repeat what you are seeing on 7.4.1. The release candidate for 7.4.2 should 
also be tried.

(I will see if I can get time to do it myself.)

Chris



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


Re: [Haskell-cafe] Building pattern and trying monads

2012-05-28 Thread Yves Parès
 observe $ flip runStateT 10 $ (put 0  mzero) | modify (+3)
   ((),13)

If the only thing you need is backtracking, using LogicT might be a little
overkill, using Maybe in the bottom of you monad stack suits just fine:

case flip runStateT 10 $ (put 0  mzero) | modify (+3) of
Just x - 
Nothing - 

2012/5/27 Roman Cheplyaka r...@ro-che.info

 * L Corbijn aspergesoe...@gmail.com [2012-05-27 14:21:39+0200]
  The solution I've in mind depends on the stack being pure. When the
  monad stack is pure a rule can be applied, returning a maybe value (or
  having a MaybeT wrapper) and when returning Nothing (failed rule)
  reverting the stack to it's point before applying the rule.
 
  As I'm not quite sure about the design (nor good at software design)
  I've some questions about this approach.
  1. Is there a better approach then using a state monad for building
  the 'products'?

 If you need to interleave building your products and analyzing them,
 State seems a reasonable choice here.

  2. My solution with saving/reverting monad-stacks seems quite a
  hassle/hack, so is it a good approach or is there something better?

 You can use a backtracking monad here ([] or Logic).

 The key thing is to put the backtracking monad in the bottom of your
 stack (everything above it will be restored on mzero). On the other
 hand, if you want some global effects that should not be restored, you
 can put corresponding monads below LogicT in the stack.

 Example:

 observe $ flip runStateT 10 $ (put 0  mzero) | modify (+3)
((),13)

 Note that put 0 had no effect here, because it was followed by mzero.

 --
 Roman I. Cheplyaka :: http://ro-che.info/

 ___
 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] What is the difference between runhaskell and compile?

2012-05-28 Thread Chris Dornan
 Sorry for the wrong information. I made a mistake when did the test.
 After more testing, I think it is a bug of ghc 7.4.1. Until now, I cannot 
 find a way to make ghc 7.4.1 compiled binary work.

I have set up this test on 7.4.1 and I cannot recreate the problem -- compiling 
and running an equivalent program (the posted program with local domain, bindDN 
and bindPW definitions localised and all other let bindings removed) leads to a 
successful server connection when passed the right password but fails to 
connect with the wrong password.

This was the behaviour you were seeing yourself with 7.2.2 was it not? I can 
only recommend re-installing 7.4.1 and trying again.

Chris



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


Re: [Haskell-cafe] Building pattern and trying monads

2012-05-28 Thread Roman Cheplyaka
* Yves Parès yves.pa...@gmail.com [2012-05-28 11:28:22+0200]
  observe $ flip runStateT 10 $ (put 0  mzero) | modify (+3)
((),13)
 
 If the only thing you need is backtracking, using LogicT might be a little
 overkill, using Maybe in the bottom of you monad stack suits just fine:
 
 case flip runStateT 10 $ (put 0  mzero) | modify (+3) of
 Just x - 
 Nothing - 

Indeed, I didn't realise that Maybe may be (no pun intended) sufficient here!

-- 
Roman I. Cheplyaka :: http://ro-che.info/

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


Re: [Haskell-cafe] Building pattern and trying monads

2012-05-28 Thread Yves Parès
Actually, I think the backtracking property here stems more from the
MonadPlus StateT instance than from the properties of Maybe.
(mplus a b runs a and b by passing explicitely the same state to them).

2012/5/28 Roman Cheplyaka r...@ro-che.info

 * Yves Parès yves.pa...@gmail.com [2012-05-28 11:28:22+0200]
   observe $ flip runStateT 10 $ (put 0  mzero) | modify (+3)
 ((),13)
 
  If the only thing you need is backtracking, using LogicT might be a
 little
  overkill, using Maybe in the bottom of you monad stack suits just fine:
 
  case flip runStateT 10 $ (put 0  mzero) | modify (+3) of
  Just x - 
  Nothing - 

 Indeed, I didn't realise that Maybe may be (no pun intended) sufficient
 here!

 --
 Roman I. Cheplyaka :: http://ro-che.info/

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


[Haskell-cafe] Estágio com Haskell em SP (Haskell internship at São Paulo, Brazil)

2012-05-28 Thread Felipe Almeida Lessa
(English message follows after the break.)

Olá!

Estamos procurando um estagiário para trabalhar conosco em São Paulo
capital.  Nós somos uma startup apaixonada por Haskell com uma boa
participação na comunidade e grandes projetos e desafios!

Se você está interessado, basta me mandar um e-mail
(felipe.le...@gmail.com) com um link para sua conta do GitHub (ou para
projetos em que você já tenha trabalhado).  Você não precisa ser
experiente em Haskell nem ter nenhum código Haskell publicado, mas
isso seria um diferencial =).  Como a startup está em stealth mode,
não posso divulgar o nome da empresa e por isso estou usando meu
e-mail pessoal.

Até mais!


===


Hey!

We're looking for an intern to work with us in São Paulo, Brazil.
We're a startup passionate about using Haskell with great projects and
challenges!

If you're interested, just send me an e-mail (felipe.le...@gmail.com)
with a link to your GitHub account (or to any projects you've worked
at).  You don't need to be an experienced Haskeller nor have any
published Haskell code, but that would be a plus =).  As the startup
is in stealth mode, I can't disclose the company's name nor use my
work e-mail (that's why I'm using my personal one).

Cheers,

-- 
Felipe.

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


Re: [Haskell-cafe] Fundeps and overlapping instances

2012-05-28 Thread AntC
Gábor Lehel illissius at gmail.com writes:

 
 If you're referring to the NewAxioms work Simon linked to ... [snip]
 ... It seems vaguely similar to a paper on instance chains[2]
 I saw once.

Thanks Gábor for the reference, but I don't think they're very comparable.

The instance chains is in context of fundeps and overlaps (as you'd expect 
from MPJ, since it was him who first introduced fundeps). I know fundeps 
are 'theoretically' equivalent to type families. But I think the instance 
chains paper is a good demonstration of why I find fundeps so awkward to 
follow at the superficial syntax level for type-level programming:
- you have to look first to the end of the instance to find the head;
- and assume (hope!) that the 'result' is the rightmost typevar;
- then backtrack through the list of constraints;
- some are only validation limits on the instance;
- some are calculating intermediate results (again with their result at right).

Instance chains include:
- not only resolving overlaps (yes, that's similar to NewAxioms);
- but also choosing instances based on type class membership;
  (often asked for by newbies, but really difficult to implement)
- and explicit failure leading to backtracking search

(Explicit failure is missing from NewAxioms. I don't mean backtracking, but at 
least treating certain conditions as no instance match. Oleg's HList work 
needs that (for example in the Lacks constraint), but has to fudge it by 
putting a fake instance with a fake constraint.)

Does the overall instance chain structure guarantee termination of type 
inference? I don't follow the algebra enough to be sure.

Morris  Jones' examples seem to me contrived: they've set up overlapping 
instances where you could avoid them, and even where they seem harder to 
follow. Yes, their solution is simpler than the problem they start with; but 
no, the problem didn't need to be that complex in the first case. (I'm looking 
especially at the GCD/Subt/Lte example -- I think I could get that to work in 
Hugs with fundeps and no overlaps.)

I'm surprised there isn't a Monad Transformer example: [3] by MPJ uses 
overlaps for MonadT. And MonadT was (I thought) what gave all the trouble with 
overlaps and default instances and silently changing behaviour. (There's a 
brief example in Morris' supporting survey - ref [11] in [2].)

Anybody out there can explain further?

AntC

 
 [2] http://citeseerx.ist.psu.edu/viewdoc/download?
doi=10.1.1.170.9113rep=rep1type=pdf
 
  [3] Functional Programming with Overloading and Higher-Order Polymorphism
  Mark P. Jones, 1995




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


Re: [Haskell-cafe] What is the difference between runhaskell and compile?

2012-05-28 Thread Magicloud Magiclouds
Interesting. I have this code tested in Debian unstable/stable, CentOS
6.1, all 64 bit, with two different version of libldap2.
At first, Debian-s were installed with 7.4.1, CentOS with 7.2.2. Only
in CentOS the code connected after compiled.
Then I removed 7.4.1 from Debian stable and installed 7.2.2. The code worked.
At last, I installed 7.4.1 in CentOS. The code did not work.

Could you send the .hi/.o to me, so maybe I could find out the
different? Also the exact original source.
Thank you.

On Mon, May 28, 2012 at 6:27 PM, Chris Dornan ch...@chrisdornan.com wrote:
 Sorry for the wrong information. I made a mistake when did the test.
 After more testing, I think it is a bug of ghc 7.4.1. Until now, I cannot 
 find a way to make ghc 7.4.1 compiled binary work.

 I have set up this test on 7.4.1 and I cannot recreate the problem -- 
 compiling and running an equivalent program (the posted program with local 
 domain, bindDN and bindPW definitions localised and all other let bindings 
 removed) leads to a successful server connection when passed the right 
 password but fails to connect with the wrong password.

 This was the behaviour you were seeing yourself with 7.2.2 was it not? I can 
 only recommend re-installing 7.4.1 and trying again.

 Chris





-- 
竹密岂妨流水过
山高哪阻野云飞

And for G+, please use magiclouds#gmail.com.

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