Re: [Haskell-cafe] Fundeps and overlapping instances
Twan van Laarhoven gmail.com> writes: > > On 24/05/12 14:14, AntC wrote: > > Simon Peyton-Jones microsoft.com> writes: > > > > Have you considered the alternative notation where multiple guards are allowed, > as in normal function definitions? Something like: > > type instance F a > | a ~ Int = Bool > | Otherwise = [a] > Hi Twan, there's various style amongst the discussions -- trace the links back from my previous post to Haskell-prime. And see SPJ's surprise (to me) announcement that there's some work in progress, which gives something very like it. But no, I don't like it: it means I can't put different instances in different modules (so far as I can tell). > ..., which would allow you to write closed type functions. Please explain (because I haven't seen this stated anywhere): what is the use case for closed type functions? As opposed to explicitly dis-overlapped type functions. > > I think this variant is almost equivalent to your proposal ... No: closed functions mean you have to declare all your instances in the same place, in the same module. The whole point of the instance mechanism (or so I thought) is that it's expandable. To see why, consider my example with a 2-argument type function. http://www.haskell.org/pipermail/haskell-prime/2012-May/003690.html (I haven't seen enough detail from the closed type func or IFEQ styles to know whether we could be 'open' on the first arg, but closed on the second.) > I also don't know how hard something like this would be to implement. ... Indeed! I've proposed implication constraints, see http://www.haskell.org/pipermail/haskell-prime/2012-May/003689.html That's from the Sulzmann and Stuckey 2002 paper, and I think available for type reasoning in such things as Chameleon. Implication Constraints are used for the OutsideIn(X) approach to implement GADT's with local constraints. (But what I've added is a dis-equality test in the antecedent.) The evidence we need to satisfy the dis-equality guards does not have to be a fully-grounded type, it just needs to be enough that the types can't be equal (typically, the outermost constructor). But it looks like the work SPJ pointed to is using closed style. If all they're trying to do is support HList and similar, I guess that's good enough. I tried to explain all this the best part of a year ago. (Admittedly my explanation was a bit turgid, re-reading it today. And not that I was saying anything that hadn't been said by others -- it's resurfaced several times.) Funny how GHC-central just barrels ahead and ignores all those ideas, apparently without explaining why. AntC ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Problem with packet documentation generated by cabal on windows 7
On Fri, May 25, 2012 at 01:19:11AM +0200, Nicu Ionita wrote: > Hi cafe, > > I have a problem with haddock documentation created when installing > new packages with cabal on windows. > The generated html files have all links in the form > j:\Users\...\doc\...\xxx.html, but firefox says, it cannot open that > link. > Actually all links should be prefixed by "file:///". > > I wonder if this is only on windows so and if there is a solution to > this. Is there a cabal or haddock flag for this? It might help to know what version of haddock you have. Here, on my Linux machine, all generated links are relative and hence contain no 'http://' or 'file:///' prefix. /M -- Magnus Therning OpenPGP: 0xAB4DFBA4 email: mag...@therning.org jabber: mag...@therning.org twitter: magthe http://therning.org/magnus I invented the term Object-Oriented, and I can tell you I did not have C++ in mind. -- Alan Kay pgpFNoRnAafd9.pgp Description: PGP signature ___ 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?
Versions: libldap2 2.4.28 LDAP 0.6.6 ghc 7.4.1 Code below: import LDAP main :: IO () main = do let domain = "vancloa.cn" bindDN = "CN=wangshida.admin,OU=admin_accounts,DC=vancloa,DC=cn" bindPW = "" baseDN = Just "DC=vancloa,DC=cn" ldapFilter = Just ("(&(sAMAccountName=" ++ alias ++ ")(&(objectClass=user)(!(ou=Recycle_Bin") ldap <- ldapInit domain ldapPort ldapSimpleBind ldap bindDN bindPW And ghc -threaded does not help. On Fri, May 25, 2012 at 11:20 AM, Brandon Allbery wrote: > On Thu, May 24, 2012 at 11:05 PM, Magicloud Magiclouds > 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. ___ 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?
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 ___ 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?
If it is simple then please paste it somewhere. Perhaps stackoverflow would be a better medium for this discussion. -Thomas On Thu, May 24, 2012 at 8:05 PM, Magicloud Magiclouds 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. > > On Thu, May 24, 2012 at 8:15 PM, Vincent Ambo wrote: >> Can you paste your code somewhere? I'm using the LDAP package at work (for >> authenticating a Yesod app) and a quick test of the basic LDAP package in >> GHCi works for me: >> >> λ> import LDAP >> λ> ldap <- ldapInit "10.0.0.12" ldapPort >> λ> ldapSimpleBind ldap "geva" "**" >> λ> let desiredAttr = LDAPAttrList ["name"] >> λ> let searchDN = Just "OU=Redacted,DC=redacted,DC=com" >> λ> let searchFilter = Just "sAMAccountName=geva" >> λ> ldapSearch ldap searchDN LdapScopeSubtree searchFilter desiredAttr False >> [LDAPEntry {ledn = "CN=Vincent Ambo,OU=Redacted,DC=redacted,DC=com", leattrs >> = [("name",["Vincent Ambo"])]}] >> >> It also works in compiled applications and in source files run with >> runhaskell. >> >> Our directory server runs Active Directory. >> >> On May 24, 2012, at 11:36 AM, Magicloud Magiclouds wrote: >> >>> Hi, >>> I am writing a small program using LDAP hackage. A weird problem occured. >>> When the code was run by runhaskell, things were fine, worked as expected. >>> But when ghc compiled (no any args), and ran, I got this: LDAP >>> error: ldapSimpleBind: LDAPException LdapServerDown(-1): Can't contact >>> LDAP server. >>> There is sure no problem with the server. >>> So I am confused. I thought the two supposed to be the same. >>> -- >>> 竹密岂妨流水过 >>> 山高哪阻野云飞 >>> >>> And for G+, please use magiclouds#gmail.com. >>> >>> ___ >>> Haskell-Cafe mailing list >>> Haskell-Cafe@haskell.org >>> http://www.haskell.org/mailman/listinfo/haskell-cafe >> > > > > -- > 竹密岂妨流水过 > 山高哪阻野云飞 > > And for G+, please use magiclouds#gmail.com. > > ___ > 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?
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. On Thu, May 24, 2012 at 8:15 PM, Vincent Ambo wrote: > Can you paste your code somewhere? I'm using the LDAP package at work (for > authenticating a Yesod app) and a quick test of the basic LDAP package in > GHCi works for me: > > λ> import LDAP > λ> ldap <- ldapInit "10.0.0.12" ldapPort > λ> ldapSimpleBind ldap "geva" "**" > λ> let desiredAttr = LDAPAttrList ["name"] > λ> let searchDN = Just "OU=Redacted,DC=redacted,DC=com" > λ> let searchFilter = Just "sAMAccountName=geva" > λ> ldapSearch ldap searchDN LdapScopeSubtree searchFilter desiredAttr False > [LDAPEntry {ledn = "CN=Vincent Ambo,OU=Redacted,DC=redacted,DC=com", leattrs > = [("name",["Vincent Ambo"])]}] > > It also works in compiled applications and in source files run with > runhaskell. > > Our directory server runs Active Directory. > > On May 24, 2012, at 11:36 AM, Magicloud Magiclouds wrote: > >> Hi, >> I am writing a small program using LDAP hackage. A weird problem occured. >> When the code was run by runhaskell, things were fine, worked as expected. >> But when ghc compiled (no any args), and ran, I got this: LDAP >> error: ldapSimpleBind: LDAPException LdapServerDown(-1): Can't contact >> LDAP server. >> There is sure no problem with the server. >> So I am confused. I thought the two supposed to be the same. >> -- >> 竹密岂妨流水过 >> 山高哪阻野云飞 >> >> And for G+, please use magiclouds#gmail.com. >> >> ___ >> Haskell-Cafe mailing list >> Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe > -- 竹密岂妨流水过 山高哪阻野云飞 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] webcam library on github
On 25 May 2012 06:20, . wrote: > Hello Cafe, > > since I haven't found anything like that, I wrote a small library [1] to > read from a webcam in Haskell, using V4L on Linux. It uses the v4l2 > package and repa for images. > Is anyone interested in contributing to that, or giving some hints on > how it could be made faster (I am not sure if I use repa correctly for > best performance at all times), or just in emitting any other > constructive comments? If yes, please give me a shout. > > PS I would put the whole thing on hackage, but my cabal currently > doesn't want to do an sdist. I've downloaded and built this. I had to also download Claude Heiland-Allen's v4l2 source from gitorious, as that package does not seem to be on hackage (though his other related packages are). I guess your package won't build on hackage until v4l2 is uploaded ... In any case I was able to run "cabal sdist". It gave a warning about no Setup.hs file; I've sent you a pull request which adds this, and also relaxes some library constraints in the cabal file. Two questions: * you've set the license to GPL3, but the C libraries it builds on are LGPL-2.1 (libv4l2) and repa and the haskell bindings it uses are BSD3. GPL3 seems a bit restrictive for a library. * the name hsimage is fairly broad, I'd suggest a simpler name like repa-v4l2. If you want to support other device APIs or add other software image processing routines, I think it would make more sense to put those in separate packages. cheers, Conrad. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Problem with packet documentation generated by cabal on windows 7
Hi cafe, I have a problem with haddock documentation created when installing new packages with cabal on windows. The generated html files have all links in the form j:\Users\...\doc\...\xxx.html, but firefox says, it cannot open that link. Actually all links should be prefixed by "file:///". I wonder if this is only on windows so and if there is a solution to this. Is there a cabal or haddock flag for this? Nicu ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] webcam library on github
Hello Cafe, since I haven't found anything like that, I wrote a small library [1] to read from a webcam in Haskell, using V4L on Linux. It uses the v4l2 package and repa for images. Is anyone interested in contributing to that, or giving some hints on how it could be made faster (I am not sure if I use repa correctly for best performance at all times), or just in emitting any other constructive comments? If yes, please give me a shout. Cheers, Christian PS I would put the whole thing on hackage, but my cabal currently doesn't want to do an sdist. [1] https://github.com/cgo/hsimage ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] "Generic figures and their glueings" book ..... please help
Hello, I think the above book by Reyes, Reyes and Zolfaghari is quite intriguing. At the same time I can't get my mind around the notions of "generic figures" and "change of figures"! The first seems to be objects in the base category and the latter morphisms in the base category. Whoever has read this book and understands it please give me some pointers. Sorry the vague call for help. Kind regards, Vasili ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] A functional programming solution for Mr and Mrs Hollingberry
On Wed, May 23, 2012 at 11:37 PM, Richard O'Keefe wrote: > > On 21/05/2012, at 5:33 AM, Andreas Pauley wrote: >> With this in mind I've created a programming exercise where I imagine >> an OO programmer would use an object hierarchy with subtype >> polymorphism as part of the solution. > > Being unfamiliar with git, I've submitted an AWK answer by e-mail. I have committed the awk version for those interested to see: https://github.com/apauley/HollingBerries/tree/master/awk/RichardOKeefe > > I've used quite a few OO languages. I like to think that I *am* > an OO programmer. But this exercise struck me from the beginning > as something where classes would add nothing but bulk. As a fan > of Smalltalk, I have to say that the Smalltalk version confirmed > this for me; a Smalltalk solution for this exercise could be a lot > smaller than that one if it _didn't_ introduce new classes. Maybe this is an example of where we as an industry has been somewhat brainwashed. For many programmers it is difficult to envision coding pretty much anything without classes. Do you know of an exercise where classes would add value? Something fairly small, roughly similar in size to this exercise. -- http://pauley.org.za/ http://twitter.com/apauley ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Can Haskell outperform C++?
> Oops, forgot to reply-to-all. N! You had the right idea the first time. :-) (Please excuse us while we chide you as humorously as we can into putting this thread out of its misery.) Chris ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Can Haskell outperform C++?
Oops, forgot to reply-to-all. This was a minor clarification on Wren's behalf (he can correct me if I'm wrong). But I agree with Bryan that it's time for the thread to die: > > Do bear in mind that Java doesn't optimize ---that's the JIT's job > > What are we supposed to make of that? > > Why write that and not -- Do bear in mind that Smalltalk doesn't optimize > that's the JIT's job -- or -- Do bear in mind that C doesn't optimize > that's the compiler's job. > I believe this was referring to the fact that javac isn't an aggressive optimizing compiler on the way from source to bytecode, i.e. it's the bytecode->asm leg where the optimization effort is focused. As an outsider to things Java that's something I've had trouble understanding, actually. It doesn't seem like an either-or choice to me... -Ryan On Wed, May 23, 2012 at 4:26 PM, Isaac Gouy wrote: > > From: wren ng thornton > > > Sent: Tuesday, May 22, 2012 9:30 PM > > -snip- > > FWIW, that matches my expectations pretty well. Naive/standard Java > performing > > slower than Smalltalk; highly tweaked Java using non-standard data types > > performing on-par with or somewhat faster than Smalltalk. > > I have no difficulty believing that if you are talking about a 1996 Java > reference implementation and a 1996 Smalltalk JIT VM. > > I could believe that if you are comparing a naive Java program with a > highly tweaked Smalltalk program. > > > > That C is 7x faster is a bit on the high end, but for something like > tsort I could imagine it'd be possible. > > It's possible because it's possible to write a Java program to be slower > than it need be :-) > > > > Do bear in mind that Java doesn't optimize ---that's the JIT's job > > What are we supposed to make of that? > > Why write that and not -- Do bear in mind that Smalltalk doesn't optimize > that's the JIT's job -- or -- Do bear in mind that C doesn't optimize > that's the compiler's job. > > > -snip- > > But even still, in my experience of using Smalltalk, the standard data > > structures are much better done and so they will be on-par with what > you'd > > get from hand-tuning for Java. I've spent a lot of time trying to get > decent > > performance out of Java, not so much with Smalltalk; but the performance > with > > Smalltalk was sufficient that it wasn't needed so badly. > > Do you have a specific example that you can share? > > > ___ > 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] Fundeps and overlapping instances
On 24/05/12 14:14, AntC wrote: Simon Peyton-Jones microsoft.com> writes: [from 7 Jul 2010. I've woken up this thread at Oleg's instigation http://www.haskell.org/pipermail/haskell-prime/2011-July/003491.html ] I'm not going to talk about Fundeps. This is about introducing overlapping instances into type families. But I mean dis-overlapped overlaps, with dis- equality guards on the instances: http://www.haskell.org/pipermail/haskell-prime/2012-May/003689.html This is essentially the same proposal as the July 2011 discussion, but a little updated with actual experience of type families in their more mature form. Example type family equations: type instance F Int = Bool type instance F a | a /~ Int = [a] -- explicit dis-equality guard Have you considered the alternative notation where multiple guards are allowed, as in normal function definitions? Something like: type instance F a | a ~ Int = Bool | Otherwise = [a] The last 'otherwise' clause is mandatory, matching should never fall through. Perhaps it could be an error if that were to happen, which would allow you to write closed type functions. Note that Otherwise could be declared in the library as type Otherwise = () :: Constraint I think this variant is almost equivalent to your proposal (so maybe it's just bikeshedding). It is also very similar to the IFEQ proposal, and you can desugar one in terms of the other. I also don't know how hard something like this would be to implement. The matching of type instances would be done in the same way as now, only their expanding is changed. The compiler will at this point have to look which guards are satisfied. In this example the first guard is a~Int, and this can not be checked until more is known about a. So, even though we have a known matching instance, it can not yet be expanded. Perhaps the notation "instance F a | a /~ Int" is better, because then a type family application can be expanded iff there is a matching instance. Twan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Converting wiki pages into pdf
I invested an enormous amount of time into this problem. Accordingly I got a very well working solution. http://de.wikibooks.org/wiki/Benutzer:Dirk_Huenniger/wb2pdf http://en.wikibooks.org/wiki/File:Haskell.pdf I am happy If you find it useful. Yours Dirk Hünniger Thu, 08 Sep 2011 05:36:44 -0700 Hello all I am trying to write a Haskell program which download html pages from wikipedia including images and convert them into pdf . I wrote a small script import Network.HTTP import Data.Maybe import Data.List main = do x<- getLine htmlpage<- getResponseBody =<< simpleHTTP ( getRequest x ) -- open url --print.words $ htmlpage let ind_1 = fromJust . ( \n -> findIndex ( n `isPrefixOf`) . tails $ htmlpage ) $ "" ind_2 = fromJust . ( \n -> findIndex ( n `isPrefixOf`) . tails $ htmlpage ) $ "" tmphtml = drop ind_1 $ take ind_2 htmlpage writeFile "down.html" tmphtml and its working fine except some symbols are not rendering as it should be. Could some one please suggest me how to accomplish this task. Thank you Mukesh Tiwari ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Formalisation for types of monads
> Though I agree it's probably best not to mention the phrase "Church encoding" to beginning students. Be reassured, that was not my intention ^^. I just pointed that out to support the fact that foldr was *the* fundamental folding operator for lists. 2012/5/24 Brent Yorgey > On Wed, May 23, 2012 at 09:24:06AM +0200, Ertugrul Söylemez wrote: > > Yves Parès wrote: > > > > > > Note about []: Don't even mention foldl. The folding > > > > combinator for lists is foldr, period. > > > > > > Yes, I do agree. I came to this when I realized foldr gave the church > > > encoding of a list. > > > > Not only that. The foldr combinator has an identity fold and implements > > actual structural recursion. > > That's pretty much what a Church encoding is. Though I agree it's > probably best not to mention the phrase "Church encoding" to beginning > students. > > -Brent > > ___ > 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] Formalisation for types of monads
On Wed, May 23, 2012 at 09:24:06AM +0200, Ertugrul Söylemez wrote: > Yves Parès wrote: > > > > Note about []: Don't even mention foldl. The folding > > > combinator for lists is foldr, period. > > > > Yes, I do agree. I came to this when I realized foldr gave the church > > encoding of a list. > > Not only that. The foldr combinator has an identity fold and implements > actual structural recursion. That's pretty much what a Church encoding is. Though I agree it's probably best not to mention the phrase "Church encoding" to beginning students. -Brent ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Fundeps and overlapping instances
Simon Peyton-Jones microsoft.com> writes: > [from 7 Jul 2010. I've woken up this thread at Oleg's instigation > http://www.haskell.org/pipermail/haskell-prime/2011-July/003491.html ] > I'm not going to talk about Fundeps. This is about introducing overlapping instances into type families. But I mean dis-overlapped overlaps, with dis- equality guards on the instances: http://www.haskell.org/pipermail/haskell-prime/2012-May/003689.html This is essentially the same proposal as the July 2011 discussion, but a little updated with actual experience of type families in their more mature form. Example type family equations: type instance F Int = Bool type instance F a | a /~ Int = [a] -- explicit dis-equality guard The July 2010 thread shows how prescient SPJ was about introducing overlaps into type families (or FunDeps). The requirements he ends up with are spot-on, and I believe I have anticipated them in the proposal for dis-overlapped overlaps. > > Imagine a system “FDL” that has functional dependencies > and local type constraints. The big deal about this is that you get to exploit > type equalities in *given* constraints. Consider Oleg’s > example, cut down a bit: > > class C a b | a -> b > > instance C Int Bool > > newtype N2 a = N2 (forall b. C a b => b) > > t2 :: N2 Int > > t2 = N2 True > > We end up type-checking (True :: forall b. C Int b => > b). From the functional dependency we know that (b~Bool), so the > function should typecheck. GHC rejects this program; FDL would not. > GHC 7.2.1 still rejects this program, but accepts a version re-written to use type families: type family CF a type instance CF Int = Bool newtype N2 a = N2 (CF a)-- could be = N2 (forall b. b ~ CF a => b) t2 :: N2 Int t2 = N2 True > > But making use of these extra equalities in “given” > constraints is quite tricky. To see why look first at ... [snip] > SPJ works through 4 examples, gathering "tricky" and "nasty" situations that are unsound. The examples involve overlaps, so can't be rewritten to use type families. (And GHC rejects attempts to encode them with type classes avoiding fundeps + "a functional-dependency-like mechanism (but using equalities) for the result type".) So let me cut to SPJ's conclusions, and compare them against dis-overlapped overlaps ... > > So FDL must > > · embody eager checking for inconsistent instances, across modules > (Type families already implement this, SPJ notes below.) Yes: I expect dis-overlapped overlaps to do this. (Eager checking is Hugs' approach FWIW, and although at first it seems a nuisance, it leads to more 'crisp' development. Contrast GHC compiles inconsistent instances, but then you find you can't reach them, or get obscure failures.) Eager checking also detects and blocks the irksome imported-instances- silently-changing-behaviour behaviour. > · never resolve overlap until only a unique instance can possibly > match > Yes-ish -- instance matching doesn't have to be as strict as that: type inference must gather evidence of the dis-equality(s) in the guards before matching to the type function equation. Because the instances can't overlap, it's safe to apply the instance, as soon as the dis-equality(s) are discharged, and the head matches. > · put all overlapping instances in a single module > I don't think we need this, providing each instance 'stands alone' with its dis-equality guards. Instead, for each imported module, we validate that its instances, do not overlap, taking the guards into account. [SPJ admits that such a restriction "loses part of the point of overlap in the first place."] > > > Type families already implement the first of these. > I believe that if we added the second and third, then overlap of type families would > be fine. (I may live to eat my words here.) > AntC ___ 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?
Can you paste your code somewhere? I'm using the LDAP package at work (for authenticating a Yesod app) and a quick test of the basic LDAP package in GHCi works for me: λ> import LDAP λ> ldap <- ldapInit "10.0.0.12" ldapPort λ> ldapSimpleBind ldap "geva" "**" λ> let desiredAttr = LDAPAttrList ["name"] λ> let searchDN = Just "OU=Redacted,DC=redacted,DC=com" λ> let searchFilter = Just "sAMAccountName=geva" λ> ldapSearch ldap searchDN LdapScopeSubtree searchFilter desiredAttr False [LDAPEntry {ledn = "CN=Vincent Ambo,OU=Redacted,DC=redacted,DC=com", leattrs = [("name",["Vincent Ambo"])]}] It also works in compiled applications and in source files run with runhaskell. Our directory server runs Active Directory. On May 24, 2012, at 11:36 AM, Magicloud Magiclouds wrote: > Hi, > I am writing a small program using LDAP hackage. A weird problem occured. > When the code was run by runhaskell, things were fine, worked as expected. > But when ghc compiled (no any args), and ran, I got this: LDAP > error: ldapSimpleBind: LDAPException LdapServerDown(-1): Can't contact > LDAP server. > There is sure no problem with the server. > So I am confused. I thought the two supposed to be the same. > -- > 竹密岂妨流水过 > 山高哪阻野云飞 > > And for G+, please use magiclouds#gmail.com. > > ___ > 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] What is the difference between runhaskell and compile?
Hi, I am writing a small program using LDAP hackage. A weird problem occured. When the code was run by runhaskell, things were fine, worked as expected. But when ghc compiled (no any args), and ran, I got this: LDAP error: ldapSimpleBind: LDAPException LdapServerDown(-1): Can't contact LDAP server. There is sure no problem with the server. So I am confused. I thought the two supposed to be the same. -- 竹密岂妨流水过 山高哪阻野云飞 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] Typed TemplateHaskell?
Maybe take a look at http://hackage.haskell.org/trac/ghc/blog/Template%20Haskell%20Proposal | -Original Message- | From: haskell-cafe-boun...@haskell.org [mailto:haskell-cafe- | boun...@haskell.org] On Behalf Of Tillmann Rendel | Sent: 23 May 2012 18:20 | To: Haskell Café | Subject: Re: [Haskell-cafe] Typed TemplateHaskell? | | Hi Ilya, | | Ilya Portnov wrote: | > As far as can I see, using features of last GHC one could write typed | > TH library relatively easily, and saving backwards compatibility. | > | > For example, now we have Q monad and Exp type in "template-haskell" | > package. Let's imagine some new package, say "typed-template-haskell", | > with new TQ monad and new polymorphic type Exp :: * -> *. Using last | > GHC's features, one will easily write something like "expr :: Exp | > String", which will mean that "expr" represents a string expression. | > And we will need a new function, say runTQ :: TQ a -> Q a (or some | > more complicated type), which will turn TypedTemplateHaskell's | > constructs into plain TH. | | That would be a good thing to have. But it might be quite hard to | implement. For example, I guess you might want to have functions like | this one: | |apply :: Exp (a -> b) -> Exp a -> Exp b | | This function takes two typed expressions and produces an application. | The types ensure that the generated application will typecheck. Cool. | | But can you do the same thing for lambdas? Lambdas create functions, so | the type would be something like the following: | |lambda :: ... -> Exp (a -> b) | | But what would you put instead of the ...? | | I fear that overall, you would have to reimplement Haskell's type system | in Haskell's type system. Which sounds like a cool thing to do, but | maybe not so easily. | |Tillmann | | ___ | 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] question about linking with sqlite3
I know it. I used a sqlite.dll file that is compiled for 32bit, while my computer is 64bit. sorry for this stupid question. On Thu, May 24, 2012 at 10:04 AM, Canhua wrote: > Hi, I made a cabal package that use HDBC-sqlite3 on Windows. > When cabal install it, I got an error from ld.exe: cannot find -lsqlite3. > How can I tell ld.exe where sqlite3.dll is plcaed? > > Thanks. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Can Haskell outperform C++?
Sorry Bryan, there are a couple of comments I should make a final reply to - I'll ignore the rest. > From: Richard O'Keefe > Sent: Wednesday, May 23, 2012 10:52 PM -snip- >> Says who? Is that on your own authority or some other source you can point >> us to? > > It looks increasingly as though there is no point in this discussion. > Is there ANY conceivable criticism of Java that will not elicit > ad hominem attacks from you? It isn't an ad hominem attack to ask you who's the authority that made some recommendation. -snip- >> Wait just a moment - you wrote "I didn't _think_ I'd omitted >> anything important" and now it turns out that the measurements were made >> using your personal Smalltalk implementation! >> >> You have got to be joking. > > Why? Because you omitted basic information about the measurements you presented. -snip- >> imo It would be better to "show how much better programs using other > data structures and algorithms perform those specific tasks" than brandish > anecdotes from a past century. > > "Past century"? Insults, is it? No, it's an echo of the words you used - "...insanely difficult in Fortran 77. This century's Fortran is of course another matter." ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe