[Haskell-cafe] Compulsory relation 1 to many from entity A to entity A

2008-02-09 Thread [EMAIL PROTECTED]
Hallo! I'd like to build a database model with winHugs that allows a recursive relation. For example a single instance of entity components is related with at least another row of the entity components (1 to many relationship). How can I do that? Thank you for your attention!

[Haskell-cafe] Re: Create a list without duplicates from a list with duplicates

2008-02-09 Thread ChrisK
For Bimap is there anything like Data.Map.insertWithKey ? Stuart Cook wrote: On Sat, Feb 9, 2008 at 7:36 AM, Dan Weston [EMAIL PROTECTED] wrote: If order is important, the new bijective Data.Bimap class http://code.haskell.org/~scook0/haddock/bimap/Data-Bimap.html may be your best bet (I

[Haskell-cafe] Re: Create a list without duplicates from a list with duplicates

2008-02-09 Thread Stuart Cook
On Sun, Feb 10, 2008 at 12:19 AM, ChrisK [EMAIL PROTECTED] wrote: For Bimap is there anything like Data.Map.insertWithKey ? No. I wanted to implement the insertWith family, but it wasn't clear to me what should happen if the value produced by the user's function already exists, bound to

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-09 Thread Bertram Felgenhauer
Matthew Naylor wrote: [snip] Finally, when I say observable sharing, I don't necessarily mean it as defined by Koen Claessen and David Sands. I simply mean the use of unsafePerformIO to detect sharing, whether or not this is done by an eq predicate on Refs. (I say this because I think there

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-09 Thread Felipe Lessa
On Feb 9, 2008 12:34 PM, Bertram Felgenhauer [EMAIL PROTECTED] wrote: ghc actually provides a primop for this: reallyUnsafePtrEquality# :: a - a - Int# Use at your own risk. Why is it more than unsafe? 'unsafePerformIO' seems to me a lot unsafer than 'reallyUnsafePtrEquality#'. Also, is

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-09 Thread Bertram Felgenhauer
Matthew Naylor wrote: (snip) Now, there remains the concern that Haskell's semantics does not enforce sharing. A Haskell compiler is free to change the sharing a program at a whim, unknowingly to the programmer who may be relying on it in for an efficient program. However, to my knowledge,

Re: [Haskell-cafe] parsec3 pre-release [attempt 2]

2008-02-09 Thread Philippa Cowderoy
On Thu, 7 Feb 2008, Albert Y. C. Lai wrote: Is it good or bad to add: instance (MonadIO m) = MonadIO (ParsecT s u m) I don't see any reason not to add it - it's not as if we can prevent people lifting to IO! Good catch. -- [EMAIL PROTECTED] A problem that's all in your head is still a

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-09 Thread Wolfgang Jeltsch
Am Freitag, 8. Februar 2008 17:14 schrieb Stefan Monnier: You seem to write 12 as 1 :+ 2 instead of () :+ 1 :+ 2. But I think, the latter representation should probably be prefered. With it, :+ always has a number as its left argument and a digit as its right. Without the () :+ we

[Haskell-cafe] Re: Internships at GHC HQ

2008-02-09 Thread Paulo J. Matos
On Jan 25, 2008 11:40 AM, Simon Peyton-Jones [EMAIL PROTECTED] wrote: Would you be interested in working at Microsoft Research for three months? If so, you might want to think about applying for an internship. Simon and I are looking for interns, starting in summer 2008. Lots of

Re: [Haskell-cafe] Best practice for embedding files in a GHC-compiled tool?

2008-02-09 Thread Bertram Felgenhauer
Dave Bayer wrote: What is the best way to embed an arbitrary file in a Haskell program? I don't know the best way. I'd probably use FFI. main.hs: {-# LANGUAGE ForeignFunctionInterface #-} module Main where import Foreign import Foreign.ForeignPtr import qualified Data.ByteString as

Re: [Haskell-cafe] Inverting a Monad

2008-02-09 Thread Bas van Dijk
On Feb 7, 2008 4:58 AM, David Menendez [EMAIL PROTECTED] wrote: If you're doing any kind of backtracking or non-determinism, you might consider the msplit operation defined in Backtracking, Interleaving, and Terminating Monad Transformers http://okmij.org/ftp/Computation/monads.html#LogicT.

Re: [Haskell-cafe] Best practice for embedding files in a GHC-compiled tool?

2008-02-09 Thread Aaron Tomb
On Feb 9, 2008, at 8:03 AM, Bertram Felgenhauer wrote: Dave Bayer wrote: What is the best way to embed an arbitrary file in a Haskell program? I don't know the best way. I'd probably use FFI. snip The idea is then to use some existing tool that embeds binary data in C programs. Since

[Haskell-cafe] Newbie question: mutually exclusive strict / lazy

2008-02-09 Thread Peter Verswyvelen
Consider the function cond x y z = if x then y else z I guess we can certainly say cond is strict in x. But what about y and z? If x is true, then cond is strict in y If x is false, then cond is strict in z So we can't really say cond is lazy nor strict in its second or third argument.

Re: [Haskell-cafe] Newbie question: mutually exclusive strict / lazy

2008-02-09 Thread Daniel Fischer
Am Samstag, 9. Februar 2008 17:33 schrieb Peter Verswyvelen: Consider the function cond x y z = if x then y else z I guess we can certainly say cond is strict in x. But what about y and z? If x is true, then cond is strict in y If x is false, then cond is strict in z So we can't

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-09 Thread Matthew Naylor
Hi Tom, In addition to the sharing problem, another shortcoming of Haskell DSLs is they can not fully exploit the benefits of algebraic datatypes. Specifically, pattern matching ADTs can only be used to control the compile-time configuration of the target, it can't be used to describe the

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-09 Thread Henning Thielemann
On Fri, 8 Feb 2008, Tom Hawkins wrote: 5) Forget embedding the DSL, and write a direct compiler. In addition to the sharing problem, another shortcoming of Haskell DSLs is they can not fully exploit the benefits of algebraic datatypes. Specifically, pattern matching ADTs can only be used

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-09 Thread Henning Thielemann
On Fri, 8 Feb 2008, Wolfgang Jeltsch wrote: Am Donnerstag, 7. Februar 2008 16:31 schrieben Sie: Even if () would be preferred from the programmers point of view (I'm not sure how much we could reduce the number of instances though), it makes the representation less attractive on the

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-09 Thread Alfonso Acosta
On Feb 9, 2008 11:33 PM, Alfonso Acosta [EMAIL PROTECTED] wrote: On Feb 8, 2008 4:10 PM, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: example really applies here. Besides, you should be regarded :* as (,) and not as a constructor which would take a number and a digit Sorry for my lousy English,

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-09 Thread Alfonso Acosta
On Feb 9, 2008 4:08 PM, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: So what would (D1 :* D1) :* (D2 :* D2) mean then? Nothing. That value doesn't satisfy the Nat or Post class constraints and should be taken into consideration. Why should :* be provided a meaning? it is an unavoidable syntactical

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-09 Thread Alfonso Acosta
On Feb 8, 2008 5:14 PM, Stefan Monnier [EMAIL PROTECTED] wrote: How 'bout treating :+ as similar to `append' rather than similar to `cons'? Basically treat :+ as taking 2 numbers (rather than a number and a digit). Interpreting it like that would certainly make make more sense. But again, I

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-09 Thread Alfonso Acosta
On Feb 8, 2008 4:10 PM, Wolfgang Jeltsch [EMAIL PROTECTED] wrote: Am Donnerstag, 7. Februar 2008 16:31 schrieben Sie: Even if () would be preferred from the programmers point of view (I'm not sure how much we could reduce the number of instances though), it makes the representation less

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-09 Thread Alfonso Acosta
On Feb 9, 2008 12:28 AM, Tom Hawkins [EMAIL PROTECTED] wrote: 5) Forget embedding the DSL, and write a direct compiler. In addition to the sharing problem, another shortcoming of Haskell DSLs is they can not fully exploit the benefits of algebraic datatypes. Specifically, pattern matching

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-09 Thread Henning Thielemann
On Fri, 8 Feb 2008, Matthew Naylor wrote: Now recall that referential transparency lets you replace equals with equals without changing the *value produced* by a program. Note that it says nothing about preserving *runtime behaviour*. Sharing, for example, may be lost. So if you do

Re: [Haskell-cafe] Create a list without duplicates from a list with duplicates

2008-02-09 Thread Henning Thielemann
On Fri, 8 Feb 2008, [EMAIL PROTECTED] wrote: Hallo! Let's suppose I have a list [a,b,c,d,c,d]. I'd like to write a function that returns a new list without duplicates (in the example [a,b,c,d]). How can I do that? What is the most general way? I'd like to use the same function for a list

[Haskell-cafe] Datatypes - Haskell

2008-02-09 Thread Mattes Simeon
Hello to everybody I am an new user of Haskel and generally in functional programming and I could say that I am very impressed from this Language. Though I can't understand the use of datatypes. Let's take a firly simple situtation e.g. data Pair a b = Pair a b i.e. an new type with name Pair

Re: [Haskell-cafe] Datatypes - Haskell

2008-02-09 Thread Brandon S. Allbery KF8NH
On Feb 9, 2008, at 19:09 , Mattes Simeon wrote: e.g. data Pair a b = Pair a b struct Pair { a pair_a; b pair_b; }; data Either a b = Left a | Right b union Either { enum { Left, Right } _tag; a either_left; b either_right; }; (except that Haskell makes sure you use it properly, while C

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-09 Thread Henning Thielemann
On Fri, 8 Feb 2008, Brandon S. Allbery KF8NH wrote: On Feb 8, 2008, at 11:14 , Stefan Monnier wrote: You seem to write 12 as 1 :+ 2 instead of () :+ 1 :+ 2. But I think, the latter representation should probably be prefered. (...) How 'bout treating :+ as similar to `append' rather

Re: [Haskell-cafe] Datatypes - Haskell

2008-02-09 Thread Sebastian Sylvan
On Feb 10, 2008 12:09 AM, Mattes Simeon [EMAIL PROTECTED] wrote: Hello to everybody I am an new user of Haskel and generally in functional programming and I could say that I am very impressed from this Language. Though I can't understand the use of datatypes. Let's take a firly simple

[Haskell-cafe] ANN: Finance-Treasury 0.1.1

2008-02-09 Thread Steve Lihn
A new experimental package, Finance-Treasury, has been uploaded to hackage. It automates the fetching of Treasury's daily yield curve data (XML) and translates the data into Data.Map representation. The collection of historical data can go back to 1992.

Re: [Haskell-cafe] Re: Implementing fixed-sized vectors (using datatype algebra?)

2008-02-09 Thread Alfonso Acosta
Moving on to the implementation of fixed-sized vectors themselves ... I have been trying to implement them as a GADT but I have run into quite few problems. As a result, I'm considering to implement them using the more-traditional phantom type-parameter approach. Anyhow, I'd like to share those

Re: [Haskell-cafe] I love purity, but it's killing me.

2008-02-09 Thread Tom Hawkins
Hi Matt, On Feb 9, 2008 1:07 PM, Matthew Naylor [EMAIL PROTECTED] wrote: If you go the real compiler route, would it not make sense to take the DSL as the source language rather than Haskell? Or are the DSL and Haskell quite similar? The two are nearly identical. In fact the only