Re: [Haskell-cafe] Re: Proof question -- (==) over Bool

2010-05-22 Thread Jonas Almström Duregård
Note that all (True ==) is logically equivalent to all id and to the and function from the prelude. A more general approach based on type classes, the function taut takes a boolean function and determines (by exhaustive search) if it is a tautology: class BooleanFunction a where taut :: a -

[Haskell-cafe] Proof question -- (==) over Bool

2010-05-21 Thread R J
I'm trying to prove that (==) is reflexive, symmetric, and transitive over the Bools, given this definition: (==) :: Bool - Bool - Boolx == y = (x y) || (not x not y) My question is: are the proofs below for reflexivity and symmetricity rigorous

Re: [Haskell-cafe] Proof question -- (==) over Bool

2010-05-21 Thread Luke Palmer
2010/5/21 R J rj248...@hotmail.com: I'm trying to prove that (==) is reflexive, symmetric, and transitive over the Bools, given this definition: (==)                       :: Bool - Bool - Bool x == y                     =  (x y) || (not x not y) My question is:  are the proofs below

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-09 Thread wren ng thornton
Brandon S. Allbery KF8NH wrote: It's not a call, it's a definition as shown above. The simpler translation is: x - y becomes y = \x - (note incomplete expression; the next line must complete it) and the refutable pattern match takes place in the lambda binding. But because of the

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-09 Thread Ben Millwood
On Sun, May 9, 2010 at 7:27 AM, wren ng thornton w...@freegeek.org wrote: The only examples I can think of where we'd want 'fail'-able patterns are entirely pedagogical (and are insignificantly altered by not using 'fail'-able patterns). I can't think of any real code where it would actually

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-09 Thread Brandon S. Allbery KF8NH
On May 9, 2010, at 06:18 , Ben Millwood wrote: On Sun, May 9, 2010 at 7:27 AM, wren ng thornton w...@freegeek.org wrote: The only examples I can think of where we'd want 'fail'-able patterns are entirely pedagogical (and are insignificantly altered by not using 'fail'-able patterns). I

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-09 Thread Ivan Lazar Miljenovic
Brandon S. Allbery KF8NH allb...@ece.cmu.edu writes: I've always had the feeling that if I need catMaybes, I haven't thought through the data representation (or possibly manipulation) fully. I've used catMaybes in several places: for example, in SourceGraph only interesting analyses are

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-08 Thread David Menendez
On Sat, May 8, 2010 at 1:16 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: David Menendez d...@zednenem.com writes: On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic Well, any time you have a do-block like this you're using failable patterns: maybeAdd       :: Maybe Int -

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-08 Thread Ivan Lazar Miljenovic
David Menendez d...@zednenem.com writes: That does not invoke fail. Let's take a simpler example: do { x - Nothing; stmt }. This translates to let ok x = do { stmt } ok _ = fail ... in Nothing = ok By the definition of (=) for Maybe, 'ok' is never called. As I said in another

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-08 Thread Brandon S. Allbery KF8NH
On May 8, 2010, at 02:16 , Ivan Lazar Miljenovic wrote: David Menendez d...@zednenem.com writes: That does not invoke fail. Let's take a simpler example: do { x - Nothing; stmt }. This translates to let ok x = do { stmt } ok _ = fail ... in Nothing = ok By the definition of (=) for

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-08 Thread Ben Millwood
sites which don't obviously handle the new failing case. Presumably if they were really really sure then just a few well-placed ~s would make the problem go away. (i.e. to answer your question, pattern matching against any single-constructor data type should be unfailable in my opinion). On Sat, May 8

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Limestraël
Yes, I wonder why mtl is not updated so as to remove this restriction. 2010/5/1 John Millikin jmilli...@gmail.com You might want to make a local version of ErrorT in your library, to avoid the silly 'Error' class restriction. This is pretty easy; just copy it from the 'transformers' or 'mtl'

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
Limestraël limestr...@gmail.com writes: 2010/5/1 John Millikin jmilli...@gmail.com You might want to make a local version of ErrorT in your library, to avoid the silly 'Error' class restriction. This is pretty easy; just copy it from the 'transformers' or 'mtl' package. Yes, I wonder why

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ross Paterson
On Sat, May 08, 2010 at 07:49:57AM +1000, Ivan Lazar Miljenovic wrote: Limestraël limestr...@gmail.com writes: 2010/5/1 John Millikin jmilli...@gmail.com You might want to make a local version of ErrorT in your library, to avoid the silly 'Error' class restriction. This is pretty easy;

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Limestraël
Personally I think fail is a terrible wart, and should be shunned. So do I. I can't understand its purpose since monads which can fail can be implemented through MonadPlus. 2010/5/8 Ross Paterson r...@soi.city.ac.uk On Sat, May 08, 2010 at 07:49:57AM +1000, Ivan Lazar Miljenovic wrote:

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Gregory Crosswhite
On May 7, 2010, at 4:54 PM, Limestraël wrote: Personally I think fail is a terrible wart, and should be shunned. So do I. I can't understand its purpose since monads which can fail can be implemented through MonadPlus. As far as I can tell, its purpose is to essentially allow you to

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ross Paterson
On Sat, May 08, 2010 at 01:54:21AM +0200, Limestraël wrote: Personally I think fail is a terrible wart, and should be shunned. So do I. I can't understand its purpose since monads which can fail can be implemented through MonadPlus. It was introduced to implement pattern match failure in

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 7, 2010, at 19:54 , Limestraël wrote: Personally I think fail is a terrible wart, and should be shunned. So do I. I can't understand its purpose since monads which can fail can be implemented through MonadPlus. The translation of do syntax involves pattern matching (do { [x,y,z]

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Dan Doel
... In this case, there's no need to fail 'in the monad', because either the value in question *is* of the form (x, y), or it is bottom, in which case the whole expression should be bottom anyhow (because we're not supposed to be able to detect bottoms like that). Patterns like the above had

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread John Meacham
On Fri, May 07, 2010 at 08:27:04PM -0400, Dan Doel wrote: Personally, I don't really understand why unfailable patterns were canned (they don't seem that complicated to me), so I'd vote to bring them back, and get rid of fail. But hind sight is 20/20, I suppose (or perhaps there exist cogent

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread David Menendez
On Fri, May 7, 2010 at 10:26 PM, John Meacham j...@repetae.net wrote: On Fri, May 07, 2010 at 08:27:04PM -0400, Dan Doel wrote: Personally, I don't really understand why unfailable patterns were canned (they don't seem that complicated to me), so I'd vote to bring them back, and get rid of

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
Limestraël limestr...@gmail.com writes: Personally I think fail is a terrible wart, and should be shunned. So do I. I can't understand its purpose since monads which can fail can be implemented through MonadPlus. Polyparse uses it, and I believe Parsec does as well... -- Ivan Lazar

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
David Menendez d...@zednenem.com writes: I wonder how often people rely on the use of fail in pattern matching. Could we get by without fail or unfailable patterns? ensureCons :: MonadPlus m = [a] - m [a] ensureCons x@(_:_) = return x ensureCons _ = mzero do ... x:xs - ensureCons $

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread David Menendez
On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic ivan.miljeno...@gmail.com wrote: David Menendez d...@zednenem.com writes: I wonder how often people rely on the use of fail in pattern matching. Could we get by without fail or unfailable patterns? ensureCons :: MonadPlus m = [a] - m [a]

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
David Menendez d...@zednenem.com writes: On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic Well, any time you have a do-block like this you're using failable patterns: maybeAdd :: Maybe Int - Maybe Int - Maybe Int maybeAdd mx my = do x - mx y - my

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Brandon S. Allbery KF8NH
On May 8, 2010, at 01:16 , Ivan Lazar Miljenovic wrote: David Menendez d...@zednenem.com writes: On Sat, May 8, 2010 at 12:15 AM, Ivan Lazar Miljenovic Well, any time you have a do-block like this you're using failable patterns: maybeAdd :: Maybe Int - Maybe Int - Maybe Int maybeAdd mx

[Haskell-cafe] Re: IO (Either a Error) question

2010-05-07 Thread Maciej Piechotka
On Fri, 2010-05-07 at 19:26 -0700, John Meacham wrote: On Fri, May 07, 2010 at 08:27:04PM -0400, Dan Doel wrote: Personally, I don't really understand why unfailable patterns were canned (they don't seem that complicated to me), so I'd vote to bring them back, and get rid of fail. But

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-07 Thread Ivan Lazar Miljenovic
Brandon S. Allbery KF8NH allb...@ece.cmu.edu writes: On May 8, 2010, at 01:16 , Ivan Lazar Miljenovic wrote: Huh? What about maybeAdd (Just 2) Nothing ? Isn't that handled by the definition of (=) in Maybe, as opposed to by invoking fail? instance Monad Maybe where -- ... Nothing =

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-06 Thread Eugene Dzhurinsky
On Wed, May 05, 2010 at 02:54:27PM -0700, Ryan Ingram wrote: ErrorT is just a newtype wrapper, changing the order/application of the type variables. newtype ErrorT e m a = ErrorT (m (Either e a)) runErrorT (ErrorT action) = action This gives the bijection: ErrorT :: m (Either e a) -

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-06 Thread David Virebayre
On Thu, May 6, 2010 at 9:56 AM, Eugene Dzhurinsky b...@redwerk.com wrote: On Wed, May 05, 2010 at 02:54:27PM -0700, Ryan Ingram wrote: ErrorT is just a newtype wrapper, changing the order/application of the type variables. newtype ErrorT e m a = ErrorT (m (Either e a)) runErrorT (ErrorT

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-06 Thread Eugene Dzhurinsky
On Thu, May 06, 2010 at 10:05:05AM +0200, David Virebayre wrote: A constructor can be seen as a function that takes some parameters and produces a value for example with the type Maybe a, which has 2 constructors ; Just and Nothing : Prelude :t Just Just :: a - Maybe a the

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-06 Thread David Virebayre
By the way, I didn't exactly reply your question : [...] Basically, i don't understand what does ErrorT :: means - it should name the function - but it starts with capital letter? It's a type signature, it describes the type of ErrorT: Prelude import Control.Monad.Error Prelude

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-05 Thread Ryan Ingram
ErrorT is just a newtype wrapper, changing the order/application of the type variables. newtype ErrorT e m a = ErrorT (m (Either e a)) runErrorT (ErrorT action) = action This gives the bijection: ErrorT :: m (Either e a) - ErrorT e m a runErrorT :: ErrorT e m a - m (Either e a) We can now

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-02 Thread Eugene Dzhurinsky
On Sat, May 01, 2010 at 02:42:26PM -0700, Ryan Ingram wrote: Check out ErrorT in Control.Monad.Error :t ErrorT ErrorT :: m (Either e a) - ErrorT e m a At this point I am lost. I'm not sure that I do understand this type transformation correctly. So we have some sort of monadic type m, error

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-02 Thread Miguel Mitrofanov
ErrorT :: IO (Either Error String) - ErrorT Error IO String I can think that can be written as ErrorT :: IO (Either Error String) - ErrorT Error (IO String) Am I correct? No, you're not. Similar to function application, type application is also left-associative, so it can (but shouldn't)

[Haskell-cafe] IO (Either a Error) question

2010-05-01 Thread Eugeny N Dzhurinsky
Hello! I have some sort of strange question: assume that there are 2 functions func1 :: Int - IO (Either Error String) func2 :: String - IO (Either Error [String]) in case if there will be no IO involved, I could use Control.Monad.Either and write something like runCalc :: Int - IO (Either

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-01 Thread Ryan Ingram
can do this: runCalc = runErrorT (ErrorT (func1 p) = ErrorT . func2) The restriction to the typeclass Error is to allow implementation of the fail method in Monad. -- ryan 2010/5/1 Eugeny N Dzhurinsky b...@redwerk.com: Hello! I have some sort of strange question: assume that there are 2

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-01 Thread John Millikin
(ErrorT (func1 p) = ErrorT . func2) The restriction to the typeclass Error is to allow implementation of the fail method in Monad.  -- ryan 2010/5/1 Eugeny N Dzhurinsky b...@redwerk.com: Hello! I have some sort of strange question: assume that there are 2 functions func1 :: Int - IO

Re: [Haskell-cafe] IO (Either a Error) question

2010-05-01 Thread Miguel Mitrofanov
]) runCalc param = runEitherT $ runCalc param (EitherT is on Hackage) On 2 May 2010, at 01:37, Eugeny N Dzhurinsky wrote: Hello! I have some sort of strange question: assume that there are 2 functions func1 :: Int - IO (Either Error String) func2 :: String - IO (Either Error [String]) in case

[Haskell-cafe] A newbie question ?

2010-04-27 Thread zaxis
n = let { f = foldr (*) 1 [1..n] } in f -- View this message in context: http://old.nabble.com/A-newbie-question---tp28383563p28383563.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell

Re: [Haskell-cafe] A newbie question ?

2010-04-27 Thread Ivan Miljenovic
On 28 April 2010 10:17, zaxis z_a...@163.com wrote: newtype TypeMap = TypeMap (Map.Map TypeRep Dynamic) lookup :: Typeable a = TypeMap - Maybe a lookup (TypeMap mp) = res    where res = liftM (fromJust . fromDynamic) $ Map.lookup (typeOf $ fromJust res) mp It seems that the `res` in  

Re: [Haskell-cafe] A newbie question ?

2010-04-27 Thread Ryan Ingram
: http://old.nabble.com/A-newbie-question---tp28383563p28383563.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] A newbie question ?

2010-04-27 Thread zaxis
! - fac n = let {  f = foldr (*) 1 [1..n] } in f -- View this message in context: http://old.nabble.com/A-newbie-question---tp28383563p28383563.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe

Re: [Haskell-cafe] newbie question how to pass data

2010-04-20 Thread Stephen Tetley
Hi If you are working with characteristic functions (Point - Bool or Point - Colour...) the common way to do this is to manufacture a Num instance for functions. This gives you syntax overloading of the (+, -, *) operators. Similarly you might want to overload (or have to overload) Floating,

Re: [Haskell-cafe] newbie question how to pass data

2010-04-20 Thread Mujtaba Boori
Great job Stephen. Thank for explaining . I got it to work. On Tue, Apr 20, 2010 at 9:21 AM, Stephen Tetley stephen.tet...@gmail.comwrote: Hi If you are working with characteristic functions (Point - Bool or Point - Colour...) the common way to do this is to manufacture a Num instance for

[Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Mujtaba Boori
Hello I am sorry for the silly question. I have a function as the following func:: ((Float,Float) -Bool) - Float - ((Float,Float) - Bool) I am trying to make calculation in this type ((Float,Float) -Bool) with Float and then pass the information to ((Float,Float) - Bool) Thank again

Re: [Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Ozgur Akgun
Can you at least give an example of how you intend to use this func? Since you do not describe it's behaviour, it is very hard to make a useful comment (at least for me) Best, On 19 April 2010 16:54, Mujtaba Boori mujtaba.bo...@gmail.com wrote: Hello I am sorry for the silly question. I

Re: [Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Mujtaba Boori
to make a useful comment (at least for me) Best, On 19 April 2010 16:54, Mujtaba Boori mujtaba.bo...@gmail.com wrote: Hello I am sorry for the silly question. I have a function as the following func:: ((Float,Float) -Bool) - Float - ((Float,Float) - Bool) I am trying to make

Re: [Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Dan Weston
...@gmail.com wrote: Hello I am sorry for the silly question. I have a function as the following func:: ((Float,Float) -Bool) - Float - ((Float,Float) - Bool) I am trying to make calculation in this type ((Float,Float) -Bool) with Float and then pass

Re: [Haskell-cafe] newbie question how to pass data

2010-04-19 Thread Mujtaba Boori
hard to make a useful comment (at least for me) Best, On 19 April 2010 16:54, Mujtaba Boori mujtaba.bo...@gmail.com mailto:mujtaba.bo...@gmail.com wrote: Hello I am sorry for the silly question. I have a function as the following func

Re: [Haskell-cafe] Re: [Haskell] Monads Terminology Question

2010-04-17 Thread Bas van Dijk
On Mon, Apr 12, 2010 at 10:27 PM, Mark Snyder muddsny...@yahoo.com wrote: So in this line of thought, where we have the operations and the control operators, I guess my original question wasn't aware of the distinction, and was looking for a name for all of them combined.  In Haskell

[Haskell-cafe] Re: [Haskell] Monads Terminology Question

2010-04-12 Thread Conor McBride
Hi (Redirecting to cafe, for general chat.) On 12 Apr 2010, at 01:39, Mark Snyder wrote: Hello, I'm wondering what the correct terminology is for the extra functions that we define with monads. For instance, State has get and put, Reader has ask and local, etc. Is there a good name

Re: [Haskell-cafe] Re: [Haskell] Monads Terminology Question

2010-04-12 Thread Stephen Tetley
Hi Conor William Harrison calls them 'non-proper morphisms' in his various papers modelling threads etc. using resumption monads. Best wishes Stephen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Re: [Haskell] Monads Terminology Question

2010-04-12 Thread Conor McBride
Hi Stephen On 12 Apr 2010, at 13:00, Stephen Tetley wrote: Hi Conor William Harrison calls them 'non-proper morphisms' in his various papers modelling threads etc. using resumption monads. I like Bill's work on resumptions, but I'm not entirely convinced by this phrase, which strikes me

Re: [Haskell-cafe] Re: [Haskell] Monads Terminology Question

2010-04-12 Thread Stephen Tetley
Hi Conor Chuan-kai Lin uses 'effect basis' in the ICFP paper on the Unimo monads, otherwise I've seen 'operations' used. I'm on the fence for 'effect basis' vs. 'non-proper morphisms', but biased against 'operations' (as its not sufficiently characteristic). Best wishes Stephen

Re: [Haskell-cafe] Re: [Haskell] Monads Terminology Question

2010-04-12 Thread aditya siram
Sorry to interject a noob comment, and maybe I am not understanding the question but why not just call MonadState etc. Monad subclasses? get and put would then be Monad subclass functions. -deech On 4/12/10, Stephen Tetley stephen.tet...@gmail.com wrote: Hi Conor Chuan-kai Lin uses 'effect

[Haskell-cafe] Re: [Haskell] Monads Terminology Question

2010-04-12 Thread Mark Snyder
From: Conor McBride co...@strictlypositive.org To: Mark Snyder muddsny...@yahoo.com; haskell Cafe haskell-cafe@haskell.org Sent: Mon, April 12, 2010 5:34:05 AM Subject: Re: [Haskell] Monads Terminology Question Hi (Redirecting to cafe, for general chat.) On 12 Apr 2010, at 01:39, Mark Snyder

Re: [Haskell-cafe] Re: [Haskell] Monads Terminology Question

2010-04-12 Thread Stephen Tetley
On 12 April 2010 20:43, aditya siram aditya.si...@gmail.com wrote: [SNIP] ... why not just call MonadState etc. Monad subclasses? get and put would then be Monad subclass functions. Hi At a pinch, that would tie them into their (Haskell) implementation technique. Picking an example I'm

[Haskell] Monads Terminology Question

2010-04-11 Thread Mark Snyder
Hello, I'm wondering what the correct terminology is for the extra functions that we define with monads. For instance, State has get and put, Reader has ask and local, etc. Is there a good name for these? I've been calling them the non-proper morphisms (as opposed to the proper

Re: [Haskell] Monads Terminology Question

2010-04-11 Thread Tony Morris
I think these names are specific to each data type (which happens to be a monad) so unless they generalise, then they are not deserving of any special terminology than any other functions. While State and Reader are both Monads, they are also many other things such as Functor and Applicative (and

Re: [Haskell] Monads Terminology Question

2010-04-11 Thread Bernie Pope
On 12 April 2010 10:39, Mark Snyder muddsny...@yahoo.com wrote:     I'm wondering what the correct terminology is for the extra functions that we define with monads.  For instance, State has get and put, Reader has ask and local, etc.  Is there a good name for these?  I've been calling them

Re: [Haskell-cafe] Performance question

2010-04-09 Thread Ozgur Akgun
A lte reply, but if you still need to have circular module depency: 4.6.9. How to compile mutually recursive modules in http://www.haskell.org/ghc/docs/latest/html/users_guide/separate-compilation.html On 21 March 2010 01:31, Arnoldo Muller arnoldomul...@gmail.com wrote: Hello Daniel,

Re: [Haskell-cafe] Performance question

2010-03-20 Thread Arnoldo Muller
Hello Daniel, Regarding your solution, can I apply {-# SPECIALISE ... #-} statements to datatypes I define? And if so, I am not able to import the datatypes to the module where binarySearch is. The problem is that if I import them a circular dependency is detected and the compiler gives an error.

[Haskell-cafe] Re: Performance question

2010-03-19 Thread Achim Schneider
Arnoldo Muller arnoldomul...@gmail.com wrote: Right now, the bottleneck of my program is in binarySearch', the function must be called a few billion times. Do you have any ideas on how to improve the performance of this function? The fastest way to do a binary search is to reify it into

Re: [Haskell-cafe] Re: Performance question

2010-03-19 Thread Arnoldo Muller
Thank you all, I will apply your suggestions to my function. Thank you for making the process of learning Haskell much easier! Arnoldo On Fri, Mar 19, 2010 at 4:21 PM, Achim Schneider bars...@web.de wrote: Arnoldo Muller arnoldomul...@gmail.com wrote: Right now, the bottleneck of my

[Haskell-cafe] Performance question

2010-03-18 Thread Arnoldo Muller
Hello! I am trying to implement a binary search function that returns the index of an exact or the (index + 1) where the item should be inserted in an array if the item to be searched is not found (I am not trying to insert data in the array) . Right now, the bottleneck of my program is in

Re: [Haskell-cafe] Performance question

2010-03-18 Thread Daniel Fischer
Am Donnerstag 18 März 2010 19:59:33 schrieb Arnoldo Muller: Hello! I am trying to implement a binary search function that returns the index of an exact or the (index + 1) where the item should be inserted in an array if the item to be searched is not found (I am not trying to insert data in

Re: [Haskell-cafe] Performance question

2010-03-18 Thread Daniel Fischer
Am Donnerstag 18 März 2010 20:49:30 schrieb Daniel Fischer: Am Donnerstag 18 März 2010 19:59:33 schrieb Arnoldo Muller: Hello! I am trying to implement a binary search function that returns the index of an exact or the (index + 1) where the item should be inserted in an array if the

Re: [Haskell-cafe] Performance question

2010-03-18 Thread Andrew Coppin
Daniel Fischer wrote: If it's called often, and the arrays are 0-based and Int-indexed, import Data.Array.Base (unsafeAt) and replacing ! with `unsafeAt` should give a speed-up, though probably not terribly much. If you don't need the polymorphism and your array elements are unboxable, using

Re: [Haskell-cafe] Performance question

2010-03-18 Thread Daniel Fischer
Am Donnerstag 18 März 2010 21:57:34 schrieb Daniel Fischer: Contrary to my expectations, however, using unboxed arrays is slower than straight arrays (in my tests). However, a few {-# SPECIALISE #-} pragmas set the record straight. Specialising speeds up both, boxed and unboxed arrays,

Re: [Haskell-cafe] Performance question

2010-03-18 Thread Roman Leshchinskiy
On 19/03/2010, at 08:48, Daniel Fischer wrote: Am Donnerstag 18 März 2010 21:57:34 schrieb Daniel Fischer: Contrary to my expectations, however, using unboxed arrays is slower than straight arrays (in my tests). However, a few {-# SPECIALISE #-} pragmas set the record straight. This is

Re: [Haskell-cafe] Performance question

2010-03-18 Thread Andrey Sisoyev
: http://old.nabble.com/Performance-question-tp27949969p27950864.html Sent from the Haskell - Haskell-Cafe mailing list archive at Nabble.com. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] Re: Happstack basic question

2010-03-15 Thread Gracjan Polak
I'd like to add a warning to this discussion. You might be affected by this issue: http://trac.haskell.org/network/ticket/11 TL;DR: It is kind of random if you bind to IPv4 or IPv6 or both. For example Windows Vista likes to bind to IPv6 only. Watch your ports and protocols! -- Gracjan

Re: [Haskell-cafe] Happstack basic question

2010-03-15 Thread Jeremy Shaw
.html - jeremy On Thu, Mar 11, 2010 at 8:35 AM, Martin Kiefel m...@nopw.de wrote: On Thu, Mar 11, 2010 at 09:24:05AM -0500, Kyle Murphy wrote: You misunderstand his question. He's trying to setup happstack behind a reverse proxy running on the same system, so he needs to be able to bind

[Haskell-cafe] Happstack basic question

2010-03-11 Thread Dmitry V'yal
Hello haskellers, I want to host a simple happstack application behind a reverse proxy. So ideally would be to bind it to localhost only. According to http://hackage.haskell.org/packages/archive/happstack-server/0.4.1/doc/html/Happstack-Server-HTTP-Types.html#t%3AConf Conf datatyle has only

Re: [Haskell-cafe] Happstack basic question

2010-03-11 Thread Martin Kiefel
Hi Dmitry, On Thu, Mar 11, 2010 at 11:38:44AM +0300, Dmitry V'yal wrote: Hello haskellers, I want to host a simple happstack application behind a reverse proxy. So ideally would be to bind it to localhost only. According to

Re: [Haskell-cafe] Happstack basic question

2010-03-11 Thread Kyle Murphy
You misunderstand his question. He's trying to setup happstack behind a reverse proxy running on the same system, so he needs to be able to bind it only to the loopback interface (127.0.0.1), as opposed to all the interfaces on the system (thereby making it inaccessible from the network unless

Re: [Haskell-cafe] Happstack basic question

2010-03-11 Thread Martin Kiefel
On Thu, Mar 11, 2010 at 09:24:05AM -0500, Kyle Murphy wrote: You misunderstand his question. He's trying to setup happstack behind a reverse proxy running on the same system, so he needs to be able to bind it only to the loopback interface (127.0.0.1), as opposed to all the interfaces

Re: [Haskell-cafe] Happstack basic question

2010-03-11 Thread Kyle Murphy
: On Thu, Mar 11, 2010 at 09:24:05AM -0500, Kyle Murphy wrote: You misunderstand his question. He's trying to setup happstack behind a reverse proxy running on the same system, so he needs to be able to bind it only to the loopback interface (127.0.0.1), as opposed to all the interfaces

Re: [Haskell-cafe] GHC RTS question

2010-02-24 Thread Artyom Kazak
2010/2/24 Brandon S. Allbery KF8NH allb...@ece.cmu.edu: On Feb 22, 2010, at 03:36 , Roman Cheplyaka wrote: * Anthony Cowley acow...@seas.upenn.edu [2010-02-21 14:15:00-0500] #! /usr/bin/env bash ./prog --RTS $*  ./prog --RTS $@ Otherwise it will work wrong if arguments contain quoted

Re: [Haskell-cafe] [offtopic] UNIX Shell (was: GHC RTS question)

2010-02-24 Thread Magnus Therning
On Wed, Feb 24, 2010 at 07:18, Roman Cheplyaka r...@ro-che.info wrote: * Brandon S. Allbery KF8NH allb...@ece.cmu.edu [2010-02-24 00:02:12-0500] On Feb 22, 2010, at 03:36 , Roman Cheplyaka wrote: * Anthony Cowley acow...@seas.upenn.edu [2010-02-21 14:15:00-0500] #! /usr/bin/env bash ./prog

Re: [Haskell-cafe] GHC RTS question

2010-02-24 Thread Roman Cheplyaka
* Artyom Kazak artyom.ka...@gmail.com [2010-02-24 10:23:07+0200] 2010/2/24 Brandon S. Allbery KF8NH allb...@ece.cmu.edu: On Feb 22, 2010, at 03:36 , Roman Cheplyaka wrote: * Anthony Cowley acow...@seas.upenn.edu [2010-02-21 14:15:00-0500] #! /usr/bin/env bash ./prog --RTS $*  

Re: [Haskell-cafe] [offtopic] UNIX Shell (was: GHC RTS question)

2010-02-24 Thread Roman Cheplyaka
* Magnus Therning mag...@therning.org [2010-02-24 09:11:54+] On Wed, Feb 24, 2010 at 07:18, Roman Cheplyaka r...@ro-che.info wrote: * Brandon S. Allbery KF8NH allb...@ece.cmu.edu [2010-02-24 00:02:12-0500] On Feb 22, 2010, at 03:36 , Roman Cheplyaka wrote: * Anthony Cowley

Re: [Haskell-cafe] [offtopic] UNIX Shell (was: GHC RTS question)

2010-02-24 Thread Donn Cave
Quoth Roman Cheplyaka r...@ro-che.info, ... Well, this agrees with POSIX. So still I don't see the difference between $@ and ${1+$@}. Whatever the standards etc. may say, I believe $@ is reliably the same as ${1+$@}, for old Bourne shells and new. Donn

[Haskell-cafe] Re: [offtopic] UNIX Shell (was: GHC RTS question)

2010-02-24 Thread Brandon S. Allbery KF8NH
On Feb 24, 2010, at 02:18 , Roman Cheplyaka wrote: #! /bin/sh ./prog --RTS ${1+$@} The longer specification above should work with whatever /bin/sh is around, whether it's Solaris /sbin/sh, FreeBSD's sh, general Linux bash, Debian/Ubuntu dash, etc. Are you referring to some Solaris shell

Re: [Haskell-cafe] [offtopic] UNIX Shell (was: GHC RTS question)

2010-02-24 Thread Brandon S. Allbery KF8NH
On Feb 24, 2010, at 05:19 , Roman Cheplyaka wrote: Well, this agrees with POSIX. So still I don't see the difference between $@ and ${1+$@}. The difference is that Unix /bin/sh predates POSIX, and on systems that usefully support a notion of backward compatibility (nostly commercial,

Re: [Haskell-cafe] GHC RTS question

2010-02-23 Thread Brandon S. Allbery KF8NH
On Feb 22, 2010, at 03:36 , Roman Cheplyaka wrote: * Anthony Cowley acow...@seas.upenn.edu [2010-02-21 14:15:00-0500] #! /usr/bin/env bash ./prog --RTS $* ./prog --RTS $@ Otherwise it will work wrong if arguments contain quoted field separators (e.g. spaces). #! /bin/sh ./prog --RTS

[Haskell-cafe] [offtopic] UNIX Shell (was: GHC RTS question)

2010-02-23 Thread Roman Cheplyaka
* Brandon S. Allbery KF8NH allb...@ece.cmu.edu [2010-02-24 00:02:12-0500] On Feb 22, 2010, at 03:36 , Roman Cheplyaka wrote: * Anthony Cowley acow...@seas.upenn.edu [2010-02-21 14:15:00-0500] #! /usr/bin/env bash ./prog --RTS $* ./prog --RTS $@ Otherwise it will work wrong if arguments

Re: [Haskell-cafe] GHC RTS question

2010-02-22 Thread minh thu
2010/2/22 Ivan Miljenovic ivan.miljeno...@gmail.com: On 22 February 2010 10:55, Lennart Augustsson lenn...@augustsson.net wrote: Supply a fix for the problem, and it will probably get included. There has probably been little demand for this feature so far. But it is a little bit weird where

Re: [Haskell-cafe] GHC RTS question

2010-02-22 Thread Roman Cheplyaka
* Anthony Cowley acow...@seas.upenn.edu [2010-02-21 14:15:00-0500] On Sun, Feb 21, 2010 at 1:58 PM, Artyom Kazak artyom.ka...@gmail.com wrote: So, if I type ./prog +RTS --RTS +RTS, the output will be +RTS. But I want the output to be equal to the input IN ALL CASES, without any quotes,

[Haskell-cafe] GHC RTS question

2010-02-21 Thread Artyom Kazak
Hello everybody! I want to write a little program, that will receive a string as command-line argument and write it in the file. But if this string contains '+RTS', GHC runtime won't pass the rest of the string to my program. What can I do to avoid this?

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Felipe Lessa
On Sun, Feb 21, 2010 at 05:45:22PM +0200, Artyom Kazak wrote: Hello everybody! I want to write a little program, that will receive a string as command-line argument and write it in the file. But if this string contains '+RTS', GHC runtime won't pass the rest of the string to my program. What

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Daniel Fischer
Am Sonntag 21 Februar 2010 16:45:22 schrieb Artyom Kazak: Hello everybody! I want to write a little program, that will receive a string as command-line argument and write it in the file. But if this string contains '+RTS', GHC runtime won't pass the rest of the string to my program. What can

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Artyom Kazak
Enclose it in double quotes (perhaps single quotes would also work) No, I want my program to work the same way as UNIX echo does. Without any double quotes. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Daniel Fischer
Am Sonntag 21 Februar 2010 18:20:43 schrieb Artyom Kazak: Enclose it in double quotes (perhaps single quotes would also work) No, I want my program to work the same way as UNIX echo does. Without any double quotes. Okay, what about If you absolutely positively want all the rest of the

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Artyom Kazak
2010/2/21 Daniel Fischer daniel.is.fisc...@web.de: Am Sonntag 21 Februar 2010 18:20:43 schrieb Artyom Kazak: Enclose it in double quotes (perhaps single quotes would also work) No, I want my program to work the same way as UNIX echo does. Without any double quotes. Okay, what about If

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Max Bolingbroke
On 21 February 2010 18:58, Artyom Kazak artyom.ka...@gmail.com wrote: So, if I type ./prog +RTS --RTS +RTS, the output will be +RTS. But I want the output to be equal to the input IN ALL CASES, without any quotes, additional options, etc. I want all the command line to go to my program. How

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Anthony Cowley
On Sun, Feb 21, 2010 at 1:58 PM, Artyom Kazak artyom.ka...@gmail.com wrote: So, if I type ./prog +RTS --RTS +RTS, the output will be +RTS. But I want the output to be equal to the input IN ALL CASES, without any quotes, additional options, etc. I want all the command line to go to my program.

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Daniel Fischer
Am Sonntag 21 Februar 2010 19:58:12 schrieb Artyom Kazak: 2010/2/21 Daniel Fischer daniel.is.fisc...@web.de: Am Sonntag 21 Februar 2010 18:20:43 schrieb Artyom Kazak: Enclose it in double quotes (perhaps single quotes would also work) No, I want my program to work the same way as UNIX

Re: [Haskell-cafe] GHC RTS question

2010-02-21 Thread Ben Millwood
On Sun, Feb 21, 2010 at 7:10 PM, Max Bolingbroke batterseapo...@hotmail.com wrote: You might be able to get somewhere by writing a custom main function in C and linking it in. According to http://haskell.org/ghc/docs/latest/html/users_guide/options-phases.html if a lib specified with the -l

<    5   6   7   8   9   10   11   12   13   14   >