[Haskell-cafe] Dynamic types through unsafeCoerce

2006-12-09 Thread Alfonso Acosta
Hi, I've been using Data.Dynamic but the Typeable requirement doesn't go well with FFI declarations (which don't accept type contexts). This is a little example of what I would like to do: data MyDyn = MyDyn myToDyn :: a - MyDyn myToDyn = unsafeCoerce myFromDyn :: MyDyn - a myFromDyn =

[Haskell-cafe] One question...

2006-12-09 Thread Waldemar Biernacki
Hello to everyone! Two days ago I have found Haskell in Internet. It sounds very nice. I have read some articles, few examples, ... yes it sounds nice. Now my problem is connected with the non-update object feature. I can't write variable instead object because - from the meaning of the word (

Re: [Haskell-cafe] One question...

2006-12-09 Thread Neil Mitchell
Hi Waldmar, Now my problem is connected with the non-update object feature. I can't write variable instead object because - from the meaning of the word ( variable ) - it has the possibility to CHANGE its value. Yes that my problem :-( main = do username - read_info_from_user

Re: [Haskell-cafe] One question...

2006-12-09 Thread Dan Mead
To think properly in haskell when you need side effects you should look at monads and how they are used in I/O. I'm no expert but most applications i've seen start like this main = do x -getArgs mapM_ somefunction(x) do is a construct that lets you have a bunch of IO statements

Re: [Haskell-cafe] One question...

2006-12-09 Thread Donald Bruce Stewart
wb: Hello to everyone! Two days ago I have found Haskell in Internet. It sounds very nice. I have read some articles, few examples, ... yes it sounds nice. Great! Welcome to Haskell. Now my problem is connected with the non-update object feature. I can't write variable instead object

Re: [Haskell-cafe] SMP support in GHC 6.6 on PPC Macs

2006-12-09 Thread Ian Lynagh
On Sat, Nov 25, 2006 at 11:28:13PM +, Ivan Tomac wrote: I've noticed that code compiled with -threaded doesn't like +RTS - Nthread count as an argument. This seems to be the case with both the binary distribution of GHC 6.6 at www.haskell.org/ghc as well as the version I built from

Re: [Haskell-cafe] One question...

2006-12-09 Thread Claus Reinke
Hello yourself!-) Two days ago I have found Haskell in Internet. It sounds very nice. I have read some articles, few examples, ... yes it sounds nice. you need to try it as well. haskell.org has information, tutorials, interactive implementations (and to answer the likely follow-on question:

Re: [Haskell-cafe] One question...

2006-12-09 Thread Bulat Ziganshin
Hello Waldemar, Saturday, December 9, 2006, 7:57:52 PM, you wrote: 1. At the beginning the user should write her/his name (for instance as the application parameter). 2. Let's assume that the application has many various functions defined inside, and - after printing each of the outputs -

Re: [Haskell-cafe] Dynamic types through unsafeCoerce

2006-12-09 Thread Taral
On 12/9/06, Alfonso Acosta [EMAIL PROTECTED] wrote: I've been using Data.Dynamic but the Typeable requirement doesn't go well with FFI declarations (which don't accept type contexts). Can you be a little more specific? mt2mgt :: MyType a b - MyGenType mt2mgt = MyGenType.myToDyn mgt2mt ::

Re: [Haskell-cafe] Dynamic types through unsafeCoerce

2006-12-09 Thread Alfonso Acosta
On 12/9/06, Taral [EMAIL PROTECTED] wrote: On 12/9/06, Alfonso Acosta [EMAIL PROTECTED] wrote: I've been using Data.Dynamic but the Typeable requirement doesn't go well with FFI declarations (which don't accept type contexts). Can you be a little more specific? Functions like this one are

Re: [Haskell-cafe] Dynamic types through unsafeCoerce

2006-12-09 Thread Udo Stenzel
Alfonso Acosta wrote: I've been using Data.Dynamic but the Typeable requirement doesn't go well with FFI declarations (which don't accept type contexts). You wouldn't need a Typeable context anyway; what's biting you is that Dynamic is not one of the primitive types that can pass across the

Re: [Haskell-cafe] Dynamic types through unsafeCoerce

2006-12-09 Thread Alfonso Acosta
On 12/9/06, Udo Stenzel [EMAIL PROTECTED] wrote: You wouldn't need a Typeable context anyway; what's biting you is that Dynamic is not one of the primitive types that can pass across the FFI. There are good reasons for that and unsafeCoerce certainly cannot invalidate them. You want a

Re: [Haskell-cafe] Dynamic types through unsafeCoerce

2006-12-09 Thread Taral
On 12/9/06, Alfonso Acosta [EMAIL PROTECTED] wrote: Functions like this one are not directy exportable myfunc :: (Tyeable a, Typeable b) = MyType a b ... Well, that's true. Then again, you can't export that type anyway without use of a StablePtr. All StablePtrs are exportable. Uhm thinking

Re: [Haskell-cafe] Dynamic types through unsafeCoerce

2006-12-09 Thread Lemmih
On 12/9/06, Alfonso Acosta [EMAIL PROTECTED] wrote: On 12/9/06, Udo Stenzel [EMAIL PROTECTED] wrote: You wouldn't need a Typeable context anyway; what's biting you is that Dynamic is not one of the primitive types that can pass across the FFI. There are good reasons for that and unsafeCoerce

[Haskell-cafe] New Layout Rule take 2

2006-12-09 Thread John Meacham
I have made some improvements to the algorithm, and I am happy to say that with some minor tweaks, it correctly lays out the programs in the nofib suite. the algorithm is not much more complicated than the current one in the report, but doesn't have the parse-error rule. it does require a single

[Haskell-cafe] laziness

2006-12-09 Thread Ranjan Bagchi
Hi -- I'm using ghc 6.6, and I had some questions about the extend of laziness and foldr. I've noticed the following: x = foldr (:) [] [1..] (take 10) x yields [1..10] Which is great.. however, what I'd like to fold the list over a tuple: foo x (l,payload) = ((x:l), payload) (x,_) = foldr