Closed type families, apartness, and occurs check

2014-07-02 Thread Brandon Moore
From the user manual, it sounds like a clause of a closed type family should be rejected once no subsitution of the type could make it unify with the clause. If so, it doesn't seem to do an occurs check: type family IsEq a b :: Bool where   IsEq a a = True   IsEq a b = False :kind! forall a

Re: Closed type families, apartness, and occurs check

2014-07-02 Thread Brandon Moore
It is conceivable that some restrictions around UndecidableInstances (short of banning it in a whole program, including all importing modules) can mitigate this problem, but no one I know has gotten to the bottom of it. Richard On Jul 2, 2014, at 4:19 AM, Brandon Moore brandon_m_mo...@yahoo.com wrote

Re: [Haskell-cafe] is Haskell missing a non-instantiating polymorphic case? (missing link added)

2011-10-23 Thread Brandon Moore
From: Adam Megacz meg...@cs.berkeley.edu Hrm, it seems that I hit send instead of save draft when shutting down my computer last night. On 2011-10-22 22:48:55 -0700, Adam Megacz said: I've written up a short example of the problems that happen here: Here is the link which was missing

Re: [Haskell-cafe] Fwd: how to increase the stack size

2011-10-16 Thread Brandon Moore
From: kolli kolli nammukoll...@gmail.com Subject: [Haskell-cafe] Fwd: how to increase the stack size when I am running the program in my terminal on ubuntu its showing me GHC stack-space overflow: current limit is 536870912 bytes. Use the `-Ksize' option to increase it.  how can i increase the

Re: [Haskell-cafe] Question: Lazy Incremental Evaluation and Haskell?

2011-10-07 Thread Brandon Moore
From: Peter Gammie pete...@gmail.com Oct 6. 2011 6:58 PM Ben, On 07/10/2011, at 8:55 AM, Benjamin Redelings I wrote: My question is, roughly, is there already an existing framework for incremental evaluation in Haskell? Margnus Carlsson did something monadic several years ago.

Re: [Haskell-cafe] Evaluating type expressions in GHCi

2011-09-21 Thread Brandon Moore
From: Sean Leather leat...@cs.uu.nl I would like to ask GHCi for the type that a type expression will evaluate to, once all definitions of type synonyms and (when possible) type families have been inlined. It appears that I can do some part of this for type T by using :t undefined :: T: ...

Parallel --make (GHC build times on newer MacBook Pros?)

2011-08-26 Thread Brandon Moore
From: Evan Laforge qdun...@gmail.com Sent: Friday, August 26, 2011 6:35 PM Subject: Re: GHC build times on newer MacBook Pros? On Tue, Aug 23, 2011 at 10:24 AM, David Terei davidte...@gmail.com wrote:   I have a 16 core machine at work (with 48GB of ram, a perk of the job   :)). GHC can

Re: [Haskell-cafe] cap 3: stopping thread 3 (stackoverflow)

2011-06-07 Thread Brandon Moore
- Original Message - From: Johannes Waldmann waldm...@imn.htwk-leipzig.de Sent: Tuesday, June 7, 2011 8:22 AM Here's source and logs: http://www.imn.htwk-leipzig.de/~waldmann/draft/skpp11/subseqsum/Subseqsum.hs The program is meant to show an application of the third

Re: [Haskell-cafe] How to install GhC on a Mac without registering?

2011-06-06 Thread Brandon Moore
From: Chris Smith cdsm...@gmail.com June 6, 2011 8:58 AM On Mon, 2011-06-06 at 08:51 +0100, Malcolm Wallace wrote: In paying for XCode 4, you are getting a lot of proprietary code in addition to gcc. True... but not *using* it. However, XCode 3 remains free to download, if you are a

Re: [Haskell-cafe] How on Earth Do You Reason about Space?

2011-05-31 Thread Brandon Moore
I can't reproduce heap usage growing with the size of the input file. I made a word list from Project Gutenberg's copy of War and Peace by tr -sc '[[:alpha:]]' '\n' pg2600.txt words.txt Using 1, 25, or 1000 repetitions of this ~3MB wordlist shows about 100MB of address space used according to

Re: [Haskell-cafe] How on Earth Do You Reason about Space?

2011-05-31 Thread Brandon Moore
Wait, do ByteStrings show up on a heap profile, if the space is allocated with malloc? Anyway, I think my tests still show that the memory used by the process doesn't grow simply by adding more data, if you are no longer added keys to the map. - Original Message - From: Brandon Moore

Re: [Haskell-cafe] What's the advantage of writing Haskell this way?

2011-05-30 Thread Brandon Moore
From: John Ky newho...@gmail.com Sent: Monday, May 30, 2011 8:01 AM Hi all, I'm trying to learn about enumerators by reading this paper and came across some code on page 2 that I found hard to digest, but I think I finally got it: Hi John. These programs should behave identically, and I think

Re: [Haskell-cafe] Sub class and model expansion

2011-05-29 Thread Brandon Moore
From: Patrick Brown; Sent: Sunday, May 29, 2011 5:42 PM Subject: Re: [Haskell-cafe] Sub class and model expansion Ryan, Thank you for your helpful reply. I have no real understanding of dependent types (DT) From the web is seems that DTs are types that depend on *values*. How does the

Re: [Haskell-cafe] Parallel compilation and execution?

2011-05-26 Thread Brandon Moore
From: michael rice, Thursday, May 26, 2011 Subject: Re: [Haskell-cafe] Parallel compilation and execution? Thank, Daniel Multiple threads are in evidence in my system monitor, but I wonder why I'm getting two different answers, one twice the other. The first is the parallel solution and the

Re: [Haskell-cafe] lambdabot hoogle

2011-05-25 Thread Brandon Moore
From: Jacek Generowicz Sent: May 25, 2011 2:45 PM On 2011 May 25, at 17:42, Gwern Branwen wrote: On Wed, May 25, 2011 at 11:08 AM, Jacek Generowicz jacek.generow...@cern.ch wrote: I've already stumbled across mueval and hoogle as things that need to be installed separately before

Re: [Haskell-cafe] Cabal: disabling -fvia-C

2011-05-24 Thread Brandon Moore
Henning Thielemann, Tuesday, May 24, 2011 On Tue, 24 May 2011, Jacek Generowicz wrote: On 2011 May 24, at 11:12, Jacek Generowicz wrote: I have found an {-# OPTION -fvia-C #-} deep inside the lambdabot code in Plugin/Pl/Common.hs. How can I tell cabal install to ignore this? Is

Re: [Haskell-cafe] Cabal: wrapping namespace of a package into top-level module

2011-05-24 Thread Brandon Moore
- Original Message - From: max ulidtko ulid...@gmail.com To: haskell-cafe@haskell.org Cc: Sent: Monday, May 23, 2011 11:38 PM Subject: [Haskell-cafe] Cabal: wrapping namespace of a package into top-level module Hi haskell-cafe. I have a package which builds with cabal pretty

Re: [Haskell-cafe] GHC 7, Platform 2011.2 vs OS X 10.5, Ubuntu 11.04

2011-05-23 Thread Brandon Moore
From: Jacek Generowicz jacek.generow...@cern.ch Sent: Monday, May 23, 2011 4:17 AM [TL;DR: there's a concrete question at the bottom.] Once again I find myself in the pleasant situation where the slings and arrows of life in general are slightly less intense, and I manage to find a few

Re: [Haskell-cafe] parMap doesn't work fine

2011-05-12 Thread Brandon Moore
Hello! I've just started using parallel computations in Haskell. parMap works fine, it is so easy to use. However, parMap fails with functions returning lazy structures, e.g. tuples. This code works as expected: (parMap rpar) bm tvalues Using rpar is redundant. That strategy

Re: Package management

2011-04-28 Thread Brandon Moore
From: Albert Y. C. Lai tre...@vex.net To: glasgow-haskell-users@haskell.org Sent: Wed, April 27, 2011 9:53:38 PM Subject: Re: Package management On 11-04-26 05:05 PM, Brandon Moore wrote: There are already hashes to keep incompatible builds of a package separate. Would anything break

Package management

2011-04-26 Thread Brandon Moore
Based on my own misadventures and Albert Y. C. Lai's SICP (http://www.vex.net/~trebla/haskell/sicp.xhtml) it seems the that root of all install problems is that reinstalling a particular version of a particular package deletes any other existing builds of that version, even if other packages

Re: [Haskell-cafe] Haskell from SML - referrential Transparency?!

2011-04-19 Thread Brandon Moore
Thanks. It was the no computation needed difference that I was missing, and was including (falsely) in my expectations for same result, i.e. including the same traces. To be clear, Debug.trace is not referentially transparent. It's only supposed to be used for debugging. Brandon

Re: [Haskell-cafe] Stacking data types

2011-04-06 Thread Brandon Moore
From: Yves Parès limestr...@gmail.com Sent: Wed, April 6, 2011 1:57:51 PM Hello Café, I'm trying to get some modular data types. The idea that came to me is that I could stack them, for instance : data Character a = Character { life :: Int, charaInner :: a } data

Re: [Haskell-cafe] Encoding of Haskell source files

2011-04-04 Thread Brandon Moore
From: Michael Snoyman mich...@snoyman.com Sent: Mon, April 4, 2011 5:22:02 AM Firstly, I personally would love to insist on using UTF-8 and be done with it. I see no reason to bother with other character encodings. If by insist, you mean the standard insist that implementations support UTF-8

Re: [Haskell-cafe] Haskell programs as specifications

2011-04-03 Thread Brandon Moore
From: Patrick Browne patrick.bro...@dit.ie Sent: Sun, April 3, 2011 9:04:22 AM ... 2)My second question is more theoretical. It is stated by the author that type checking and excitability provide verification. I don't know what excitability has to do with verification. Type checking in

Re: [Haskell-cafe] BlockedIndefinitelyOnMVar exception

2011-03-31 Thread Brandon Moore
From: Gregory Collins g...@gregorycollins.net Sent: Thu, March 31, 2011 5:03:09 AM I find this behaviour a little annoying. Sometimes I *want* the thread to block indefinitely! I.e. I want it to block until it receives a KillThread exception. Is there a better way to accomplish that

Re: [Haskell-cafe] BlockedIndefinitelyOnMVar exception

2011-03-31 Thread Brandon Moore
- Original Message From: Mitar mmi...@gmail.com To: Brandon Moore brandon_m_mo...@yahoo.com Cc: Gregory Collins g...@gregorycollins.net; Edward Z. Yang ezy...@mit.edu; Haskell Cafe haskell-cafe@haskell.org Sent: Thu, March 31, 2011 2:06:31 PM Subject: Re: [Haskell-cafe

Re: [Haskell] ANN: Yi 0.6.3

2011-03-28 Thread Brandon Moore
On 2011-03-28 20:19:15PM Brandon S Allbery KF8NH allber...@gmail.com wrote: On 3/28/11 21:15 , Ivan Lazar Miljenovic wrote: On 29 March 2011 12:10, Brandon S Allbery KF8NH allber...@gmail.com wrote: On 3/28/11 17:06 , Ivan Lazar Miljenovic wrote: On 29 March 2011 06:40, Jeff Wheeler

Re: [Haskell-cafe] Class constraints for associated type synonyms

2011-03-23 Thread Brandon Moore
From: Jan-Willem Maessen jmaes...@alum.mit.edu Sent: Wed, March 23, 2011 8:43:14 PM Hi all - I've been trying to construct a class declaration with an associated type synonym, but I'd like to constrain that type to belong to a particular class. Consider the following class:

Re: memory slop

2011-03-22 Thread Brandon Moore
On Tue, March 22, 2011 21:00:29 Tim Docker t...@dockerz.net wrote: I'm a bit shocked at the amount of wasted memory here. The sample data file has ~61k key/value pair. Hence ~122k ByteStrings - as you point out many of these are very small (1500 of them are empty). Assuming it's the

Re: [Haskell-cafe] Subsets and supersets

2011-03-16 Thread Brandon Moore
You want polymorphic variants. Check out O'Caml, or MLPolyR. Subtyping is not very compatible with first-class functions. If you have subtype-bounded polymorphism (forall A a subtype of T, ...), and your subtype relation says A - B is a subtype of C -D whenever A is a supertype of C and B is a

Re: [Haskell-cafe] simple stm question

2011-03-14 Thread Brandon Moore
I recently upgraded to ghc 7.0.2 from 6.12.3, along with the Haskell platform, and noticed that the following code no longer works as expected: waitFor tvar = atomically $ do count - readTVar tvar check (count == 0) worker tchan tvar = loop where loop = do putStrLn

Re: [Haskell-cafe] Data.ByteString.Lazy.ByteString vs Data.ByteString.Lazy.Internal.ByteString

2011-03-11 Thread Brandon Moore
It is a goal of the ByteString library that you should almost never need to work directly with the PS constructor and the things used in that definition. If you find some task involving IO or string manipulation that seems to require using the internal operations, it's probably worth bringing it

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

2011-03-05 Thread Brandon Moore
Hi Bas If you want to use your own C main(), that's documented here: http://www.haskell.org/ghc/docs/7.0-latest/html/users_guide/ffi-ghc.html#using-own-main ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Convert a function to a string of operators?

2011-03-04 Thread Brandon Moore
From: Evgeny Grablyk evgeny.grab...@gmail.com Hello! I was wondering if it was possible to convert a function (which may also call functions) to a plain list of operators on parameters. Example: If your operators are only things in Num (or maybe some other typeclasses), the

Re: [Haskell-cafe] A practical Haskell puzzle

2011-03-03 Thread Brandon Moore
From: Yitzchak Gale g...@sefer.org Brandon Moore wrote: This code produces and uses a table of all allowed combinations. I think this makes it easier to understand why the code works (and is H98). It's just as easy to make a direct version that produces one requested composition

Re: [Haskell-cafe] A practical Haskell puzzle

2011-03-02 Thread Brandon Moore
From: Yitzchak Gale g...@sefer.org To: haskell-cafe@haskell.org Cc: Heinrich Apfelmus apfel...@quantentunnel.de; Lennart Augustsson lennart.augusts...@gmail.com Sent: Wed, March 2, 2011 9:45:15 AM Subject: Re: [Haskell-cafe] A practical Haskell puzzle Thanks to everyone for the nice

Re: [Haskell-cafe] why is ghci trying to load hsc file ??

2011-02-26 Thread Brandon Moore
I assume there's a LINE directive in the file it's actually reading. Run ghci with -v to see what file it's actually trying to read. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Having trouble with instance context

2011-02-23 Thread Brandon Moore
From Kurt Stutsman kstuts...@gmail.com on Wed, February 23, 2011 9:40:09 AM Daniel Fischer wrote: No, it's not. The language report says an instance head must have the form (tyCon a1 ... an), where tyCon is a type constructor and a1 ... an are *distinct* type variables

Re: [Haskell-cafe] monadic plumbing

2011-02-22 Thread Brandon Moore
From: Alberto G. Corona agocor...@gmail.com Sent: Tue, February 22, 2011 3:03:56 PM Recently I had to navigatate trough data structures chained with mutable referenes in th STM monad. The problem is that their values are enveloped in Either or Maybe results. ... to summarize, given: foo, :

Re: [Haskell-cafe] Infinite types should be optionally allowed

2011-02-21 Thread Brandon Moore
From: Job Vranish jvran...@gmail.com On Sun, Feb 20, 2011 at 8:56 PM, Brandon Moore brandon_m_mo...@yahoo.com wrote: Typechecking with regular types isn't hard. So do I have the right idea then? To check against a signature, I can just unify the two types and then check if the unified type

Re: [Haskell-cafe] Infinite types should be optionally allowed

2011-02-20 Thread Brandon Moore
From: Job Vranish jvran...@gmail.com Sorry for bringing back an ancient thread but I'd still like to understand this better. It is still not obvious to me why typechecking infinite types is so hard. Is determining type 'equivalence' the hard part? or is that a separate issue? Typechecking

Re: [Haskell-cafe] Unable to get parallelism using `par`

2011-02-17 Thread Brandon Moore
From: C K Kashyap ckkash...@gmail.com Hi, I tried the first example from A tutorial on Parallel and Concurrent programming in Haskell but I cant seem to get sparks to get converted to OS threads. Below is the program I am using. I did ghc --make -threaded program.hs then ./program +RTS

Re: [Haskell-cafe] forkIO on GHCI does not seem to spawn the thread in the background on some OSs

2011-02-08 Thread Brandon Moore
From: David Leimbach, Sent: Tue, February 8, 2011 8:07:39 AM On Monday, February 7, 2011, C K Kashyap ckkash...@gmail.com wrote: Hi,I found that on windows and my ubuntu box, when I did this ghci t - forkIO someAction someAction started executing in the foreground - as in, the ghci

Re: [Haskell-cafe] Extending GHCi

2011-02-04 Thread Brandon Moore
Hi, I am looking for a way to extend GHCI such that I can do something like this startMyFunction will do a forkIO and listen on a network port for interaction with a remote process and will drop back to GHCI prompt where I can invoke haskell functions that'll control the way the interaction

Re: [Haskell-cafe] Inheritance and Wrappers

2011-02-02 Thread Brandon Moore
OK, what about this as a use case then. I want to create a type class 'Term' with only one function in it. The function returns a 'termTag' which labels the kind of a value in a DSL. class Term a where termTag :: a - String A user of this type-class can happily provide an instance

[Haskell-cafe] Monomorphic let bindings and darcs

2011-01-25 Thread Brandon Moore
The darcs 2.5 package uses the flat -fglasgow-exts, so it picks up MonoLocalBinds. This causes quite a few errors. The error messages are particularly bad in src/Darcs/Commands/Convert.lhs there is code of the form explicitlyPolyMorphicFun arg $- \local - ... very long body ...

Re: [Haskell-cafe] Proof in Haskell

2010-12-21 Thread Brandon Moore
- Original Message From: Colin Paul Adams co...@colina.demon.co.uk To: Daniel Fischer daniel.is.fisc...@googlemail.com Cc: haskell-cafe@haskell.org Sent: Tue, December 21, 2010 1:11:37 PM Subject: Re: [Haskell-cafe] Proof in Haskell Daniel == Daniel Fischer

Re: [Haskell-cafe] $ do?

2010-12-15 Thread Brandon Moore
From: Roman Cheplyaka r...@ro-che.info Sent: Wed, December 15, 2010 1:36:55 AM * Jonathan Geddes geddes.jonat...@gmail.com [2010-12-14 19:59:14-0700] Quick question: Why do I need the $ in the following bits of code? main = withSocketsDo $ do --do something with sockets

Re: [Haskell-cafe] GHC 7.0.1 developer challenges

2010-12-14 Thread Brandon Moore
Hi Peter I beg your pardon? I didn't say anything about 32M. I said that designing software to rely on a GHC-enforced memory limit as a means of dealing with infinite loops feels really not like a particularly good solution. As I understand the discussion, it's not about infinite loops.

Re: [Haskell-cafe] Offer to mirror Hackage

2010-12-13 Thread Brandon Moore
On Dec 13, 2010, at 6:15 PM, wren ng thornton w...@freegeek.org wrote: On 12/13/10 8:25 AM, Paul Sargent wrote: How about, as a cheep and cheerful method to get up running. If the premise is that the original server is trustworthy and the mirrors aren't, then: 1) Hash all packages on the

Re: [Haskell-cafe] Digests

2010-12-03 Thread Brandon Moore
I may be missing something, but it is not clear to me if you want cryptographic security. If you do, then the only safe choice is to use a standard algorithm (or block cipher construction, perhaps). Sorry if that's already what you are discussing - I don't know whether there are any established

Re: [Haskell-cafe] Re: [Haskell] intent-typing

2010-11-16 Thread Brandon Moore
- Original Message From: aditya siram aditya.si...@gmail.com To: Haskell Café haskell-cafe@haskell.org Cc: hask...@haskell.org; Marcus Sundman sund...@iki.fi Sent: Tue, November 16, 2010 8:18:33 AM Subject: Re: [Haskell-cafe] Re: [Haskell] intent-typing That was a great

Re: [Haskell-cafe] What is simplest extension language to implement?

2010-11-02 Thread Brandon Moore
Henning Thielemann, Tue, November 2, 2010 6:11:02 AM Yves Parès schrieb: Because he would have either to recompile the whole program or to use things like hint, both implying that GHC must be installed on the user side (600Mo+ for GHC 6.12.3) Hugs is great for running small Haskell

[Haskell-cafe] CPS Error Monad

2010-11-02 Thread Brandon Moore
) succeed) Brandon Moore ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Can a fundep force parametricity

2010-11-02 Thread Brandon Moore
I would like to make a two-parameter type class where some choices of the first type uniquely determine the second type, and other choices of the first type promise to work with any choice of the second type. This code seems a bit suspicious, but is accepted thanks to UndecidableInstances. {-#

Re: [Haskell-cafe] If Python now has a good email library; how challenging is it to call Python from Haskell?

2010-10-27 Thread Brandon Moore
On Oct 27, 2010, at 12:43 PM, cas...@istar.ca wrote: :) I will point out that Python Haskell Interface has an excellent axiom. Unfortunately, my attempt to write a nice wrapper around the Python FFI foundered years ago chasing segfaults. It doesn't seem like it should be too hard, if you

Re: [Haskell-cafe] If Python now has a good email library; how challenging is it to call Python from Haskell?

2010-10-27 Thread Brandon Moore
From: Brandon Moore brandon_m_mo...@yahoo.com On Oct 27, 2010, at 12:43 PM, cas...@istar.ca wrote: :) I will point out that Python Haskell Interface has an excellent axiom. Unfortunately, my attempt to write a nice wrapper around the Python FFI foundered years ago chasing segfaults

Re: [Haskell-cafe] Map constructor in a DSL

2010-10-26 Thread Brandon Moore
You have to figure out here how you can use the function which is the argument to map. It seems you want to end up with a function of type a - Evaluator b, to be used as an argument to mapM. One idea is to add a new constructor Var to represent variables, and something like evalVar :: Obs b -

Re: [Haskell-cafe] concurrency vs. I/O in GHC

2010-10-23 Thread Brandon Moore
On Oct 23, 2010, at 2:57 PM, Claude Heiland-Allen claudiusmaxi...@goto10.org wrote: On 23/10/10 17:42, Gregory Crosswhite wrote: On 10/23/10 7:54 AM, John Lato wrote: On Fri, Oct 22, 2010 at 6:16 PM, Bulat Ziganshin bulat.zigans...@gmail.com mailto:bulat.zigans...@gmail.com wrote: Hello John,

Re: [Haskell-cafe] Template Haskell: onward and upward

2010-10-19 Thread Brandon Moore
From: Simon Peyton-Jones simo...@microsoft.com Sent: Mon, October 18, 2010 5:02:57 PM Folks Following lots of feedback from users, especially at ICFP, I’ve evolved some proposals for Template Haskell, that should make it both more expressive, and more secure.

Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-14 Thread Brandon Moore
Thank you all for your contributions so far. Plenty of food for thought. I though I'd try to put it into practice and have a go at the motivating example I gave: essentially a EDSL for defining simple maths tests. If you have a Python version that has other features you would like, you

Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-13 Thread Brandon Moore
If you just want instances of questions you can keep it simple. How about something isomorphic to data Instance = Instance { question : String, answer : String, check : String - Bool } You could make helper functions similar to your old code, like addition : (Int , Int) - Instance You might

Re: [Haskell-cafe] Client-extensible heterogeneous types (Duck-typed variadic functions?)

2010-10-13 Thread Brandon Moore
On Oct 13, 2010, at 7:44 PM, Jacek Generowicz jacek.generow...@cern.ch wrote: On 2010 Oct 14, at 01:32, Evan Laforge wrote: I think I'm starting too see what my problem is. I think it boils down to hankering for Duck Typing and variadic functions. I fully appreciate that passing functions is

Re: [Haskell-cafe] ANNOUNCE: tls, native TLS/SSL protocolimplementation

2010-10-11 Thread Brandon Moore
While I can see your point about potentially introducing new security holes, and producing much less trusted code, I feel having tidy, pure libraries that we can all integrate into our Haskell is a benefit that far outweighs this. Especially when we have nice things like the type system,

Re: [Haskell-cafe] Re: Bulletproof resource management

2010-10-08 Thread Brandon Moore
On Oct 8, 2010, at 2:18 PM, Florian Weimer f...@deneb.enyo.de wrote: * Ben Franksen: You might be interested in Lightweight Monadic Regions http://okmij.org/ftp/Haskell/regions.html#light-weight which solve the problem (IMHO) in a much cleaner way, i.e. w/o explicit closing and also w/o

Re: [Haskell-cafe] Relaxing atomicity of STM transactions

2010-09-28 Thread Brandon Moore
On Sep 28, 2010, at 6:36 PM, Tom Hawkins tomahawk...@gmail.com wrote: Thanks for the responses, but I think I should explain a bit more. I'm not interested in being able to read the live value of a TVar at any arbitrary time (via. unsafeIOToSTM). But rather I would like looslyReadTVar to have

Re: [Haskell] Waiting on multiple Chan-nels

2006-12-12 Thread Brandon Moore
Setzer, Sebastian (ext) wrote: Hi, How do you wait on multiple channels, but read only from one of them (the first that gets an entry)? Is there a library-function I missed which already does this? This is pretty hard with Control.Concurrent.Chan. They are simply not very easy to compose.

Re: [Haskell-cafe] Dynamic types through unsafeCoerce

2006-12-12 Thread Brandon Moore
Alfonso Acosta wrote: Ok, instead of pushing about why I want to use unsafeCoerce (which I know it's not a good thing) I decided (as suggested by Taral) to paste a simplified example of my code. If anyone finds a way of implementing something equivalent to this code without unsafeCoerce# and

Re: [Haskell-cafe] Would someone explain this code to me?

2006-12-06 Thread Brandon Moore
Justin Bailey wrote: I'm reading Chris Okasaki's Purely Functional Data Structures, and some of his Haskell is confusing me. He defines the type Color and RedBlackSet as: data Color = R | B data RedBlackSet a = E | T Color (RedBlackSet a) a (RedBlackSet a) and then later he defines a

Re: [Haskell-cafe] Haskell Quiz Solution - Haskell Newbie Requesting Review

2006-11-09 Thread Brandon Moore
Justin Bailey wrote: As part of the Ruby Quiz in Haskell solutions appearing on the wiki recently, I just a solution to Ruby Quiz #100 - create a bytecode interpreter for a simple expression language. Like I said, the code below parses simple integer arithmetic expressions and generates byte

Re: [Haskell-cafe] Haskell Quiz Solution - Haskell Newbie Requesting Review

2006-11-09 Thread Brandon Moore
Justin Bailey wrote: As part of the Ruby Quiz in Haskell solutions appearing on the wiki recently, I just a solution to Ruby Quiz #100 - create a bytecode interpreter for a simple expression language. Like I said, the code below parses simple integer arithmetic expressions and generates byte

Re: [Haskell-cafe] Decorating a list of strings

2006-11-02 Thread Brandon Moore
Steve Schafer wrote: I have a list of text strings: [Alice, Bob, Cindy, Bob, Bob, Dave, Cindy] As you can see, some of the strings occur only once; others appear two or more times. I would like to end up with a new list, according to the following rules: 1) If a string occurs only once in

Heap representation evil

2006-10-23 Thread Brandon Moore
Thinking to take advantage of fortuitous heap layout of some Haskell values for interfacing with C, I've written the following function: addressOf :: a - Ptr () addressOf x = x `seq` unsafeCoerce# (Box x) data Box x = Box x For example, data A = A {-# UNPACK #-} !(Ptr Word8) {-# UNPACK #-}

Re: Heap representation evil

2006-10-23 Thread Brandon Moore
. Stable pointers might help with the GC relocating things, except I don't think having a stable pointer guarantees that the object won't be moved around, just that the stable pointer won't be invalidated by GC. On Mon, Oct 23, 2006 at 06:43:26PM -0700, Brandon Moore wrote: A different and in all

Re: [Haskell-cafe] Re: Strictness, order of IO operations: NewCGI HDBC

2006-10-20 Thread Brandon Moore
Greg Fitzgerald wrote: Does DB.getTables use 'unsafeInterleaveIO'? I would think that if an unsafe operation was *not* used, DB.disconnect could *not* execute before DB.getTables has returned every row. Either way, by the Principle of Least Surprise

Re: [Haskell-cafe] List comparisons and permutation group code

2006-10-19 Thread Brandon Moore
Nicolas Frisby wrote: I may have missed this in the discussion so far, but it seems we could use a summary. In short: isIdentity does not check for exact equivalence, only a prefix equivalence. That's why it doesn't exhibit the same time/space behavior as a reformulation based on full

Re: [Haskell-cafe] Quantifying Partial Type Annotations

2006-10-11 Thread Brandon Moore
Philippa Cowderoy wrote: I've done a bit more thinking about partial type annotations (as proposed on the Haskell' list), and I have a somewhat more concrete proposals for some of the extensions to them that perhaps also makes more sense of the original basic idea as well. I'm sending it to

[Haskell-cafe] Re: [Haskell] Replacing and improving pattern guards with PMC syntax

2006-10-02 Thread Brandon Moore
[EMAIL PROTECTED] wrote: ... So far I never considered it important to devise a concrete syntax for PMC, but triggered by the current pattern guards thread on haskell-prime, I now try to give a PMC syntax that blends well with Haskell. I think with some alterations your syntax would blend

Re: [Haskell-cafe] smallest double eps

2006-09-30 Thread Brandon Moore
Bryan Burgers wrote: Hang on, hang on, now I'm getting confused. First you asked for the smallest (positive) x such that 1+x /= x which is around x=4.5e15. 1 + 0 /= 0 0 is smaller than 4.5e15 So I don't understand this at all... But then 0 isn't positive. Why not? In any case

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-09-29 Thread Brandon Moore
Andrew Pimlott wrote: This is a follow-up to a thread from June-July[1]. The question was how to write the function initlast :: [a] - ([a], a) initlast xs = (init xs, last xs) so that it can be consumed in fixed space: main = print $ case initlast [0..10] of

Re: [Haskell-cafe] Computing lazy and strict list operations at the same time

2006-09-27 Thread Brandon Moore
Andrew Pimlott wrote: This is a follow-up to a thread from June-July[1]. The question was how to write the function initlast :: [a] - ([a], a) initlast xs = (init xs, last xs) so that it can be consumed in fixed space: main = print $ case initlast [0..10] of

Re: [Haskell-cafe] Optimizing a title matcher

2006-09-27 Thread Brandon Moore
Ketil Malde wrote: Lyle Kopnicky [EMAIL PROTECTED] writes: If you have some other metric other than prefix in mind for partial matches, then things probably get a lot more complicated. You're probably looking at calculating minimum distances in some feature-space, which calls for pretty

Re: [Haskell-cafe] A better syntax for qualified operators?

2006-09-27 Thread Brandon Moore
Brian Hulley wrote: Hi - Consider the scenario when you want to find a function that returns the i'th element of an array but all you know is that there is a module called Data.Array.IArray that will probably have such a function in it. So you start typing in your program: let ith

Re: [Haskell-cafe] flip dot

2006-09-27 Thread Brandon Moore
Greg Fitzgerald wrote: Since there's talk of removal of the composition operator in Haskell-prime http://hackage.haskell.org/trac/haskell-prime/wiki/CompositionAsDot, how about this: Instead of: foo = f . g you write: foo = .g.f A leading dot would mean, apply all unnamed parameters to the

Re: [Haskell-cafe] flip dot

2006-09-27 Thread Brandon Moore
Brandon Moore wrote: Greg Fitzgerald wrote: Since there's talk of removal of the composition operator in Haskell-prime http://hackage.haskell.org/trac/haskell-prime/wiki/CompositionAsDot, how about this: Instead of: foo = f . g you write: foo = .g.f A leading dot would mean, apply all

Re: [Haskell-cafe] foreach

2006-09-13 Thread Brandon Moore
Tim Newsham wrote: I was rewriting some non-haskell code in haskell and came up with this construct: foreach l f = mapM_ f l main = do args - getArgs foreach args (\arg - do foreach [1..3] (\n - do putStrLn ((show n) ++ ) ++ arg) ) ) which is reminiscent of foreach in other languages. Seems

Re: [Haskell-cafe] extreme newbie: hugs prompt vs load module

2006-08-23 Thread Brandon Moore
George Young wrote: [linux, ghci 6.4.3.20060820, hugs May 2006] I have just started learning Haskell. I have hugs and ghci under linux, and I'm going through the Gentle Introduction to Haskellhttp://www.haskell.org/tutorial, so far through section 4, case expressions and pattern matching. I'm

Re: class [] proposal Re: [Haskell-cafe] One thought: Num to 0 as ? to list?

2006-08-22 Thread Brandon Moore
Bulat Ziganshin wrote: Hello Malcolm, Tuesday, August 22, 2006, 4:22:50 PM, you wrote: 2) allow to use type classes in type declarations like the types itself. for example, allow the following: f :: Num a = a - Int write as f :: Num - Int and following: sequence :: Monad m = [m a] - m

[Haskell-cafe] type synonym liberalization (was class [] proposal)

2006-08-22 Thread Brandon Moore
Bulat Ziganshin wrote: Subtyping introduced in very natural (at least for OOP souls) way. We may, for example, have functions: doit :: MemBuf - IO Int hRequestBuf :: MemoryStream - IO Int hTell :: SeekableStream - IO Integral and call doit - hRequestBuf - hTell and then return result, and all

[Haskell-cafe] Re: type synonym liberalization (was class [] proposal)

2006-08-22 Thread Brandon Moore
Arie Peterson wrote: Hello Brandon, This could be handled with existential wrappers, except that the wrapping is annoying, and probably interferes with optimizing when a concrete type is known. Instead, a few changes to type synonyms handle Bulat's cases. With the proper interpretation,

Re: [Haskell-cafe] Why Not Haskell?

2006-08-04 Thread Brandon Moore
Hans van Thiel wrote: Hello All, I'm wondering why I can't find any commercial Haskell applications on the Internet. Is there any reason for this? I can think of the following possibilities only: 1) Haskell is too slow for practical use, but the benchmarks I found appear to contradict this. 2)

Re: [Haskell-cafe] Why shouldn't variable names be capitalized?

2006-08-04 Thread Brandon Moore
Martin Percossi wrote: Hi, I'm wondering what the rationale was for not allowing capitalized variable names (and uncapitalized type names and constructors). I can only think of two arguments, and IMHO both of them are bad: I'm not so sure about variable names and constructors, but the type

Re: [Haskell-cafe] if-then-else as rebindable syntax (was Re: Why does Haskell have the if-then-else syntax?)

2006-07-27 Thread Brandon Moore
David House wrote: How about we drop the idea of an auxilary cond function, and instead just use a Boolean typeclass? class Boolean b where isTrue :: b - Bool isFalse :: b - Bool I don't think this covers embedded languages. If everything lives in some monad it might be useful to rebind the

Re: [Haskell-cafe] Haskell performance in heavy numerical computations

2006-07-07 Thread Brandon Moore
Joel Reymont wrote: Is anyone using Haskell for heavy numerical computations? Could you share your experience? My app will be mostly about running computations over huge amounts of stock data (time series) so I'm thinking I might be better of with OCaml. If you are really serious about

Re: [Haskell-cafe] Deducing Show for GADTs

2006-06-28 Thread Brandon Moore
Joel Björnson wrote: Hi. I came a cross the following phenomena which, at least to me, occurs kind of awkward. The code below : data MyData a where DC1 :: (Show a ) = a - MyData a instance Show (MyData a) where show (DC1 a ) = show a yields the ghci error : 'Could not deduce (Show

Re: [Haskell-cafe] Separate a string into a list of strings

2006-06-12 Thread Brandon Moore
Clifford Beshers wrote: Sara Kenedy wrote: Hi all, I want to write a function to separate a string into a list of strings separated by commas. Example: separate :: String - [String] separate Haskell, Haskell, and Haskell = [Haskell, Haskell, and Haskell] If anyone has some ideas, please

Re: [Haskell-cafe] newbie type signature question

2006-06-09 Thread Brandon Moore
Sorry, I meant to send this to the whole list. Brock Peabody wrote: Please excuse my newbiness, but in this snippet: data (Monad m) = DataType m = DataType { f :: Char - m () } test_function :: (Monad m) = DataType m - m ()

Re: [Haskell-cafe] Type class hell

2006-06-08 Thread Brandon Moore
I don't quite understand the problem, but maybe an example involving an explicit recursion operator will help. class Foo a where foo :: a instance Foo a = Foo (Maybe a) where foo = Just foo data Rec f = In (f (Rec f)) instance Foo (f (Rec f)) = Foo (Rec f) where foo = In foo compile

Re: [Haskell-cafe] Ambiguous types for collection keys

2006-04-12 Thread Brandon Moore
Data.Dynamic: http://www.haskell.org/ghc/docs/latest/html/libraries/base/Data- Dynamic.html Or carry an instance in along with a type parameter, using existentials or GADT. Brandon Moore ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http

  1   2   >