[Haskell-cafe] What does it mean to derive equations of restricted from in Haskell?

2013-07-16 Thread Daryoush Mehrtash
In John Hughes's The Design of Pretty printing library paper, he says: The implementations which we are trying to derive consist of equations of a restricted form. We will derive implementations by proving their constituent equations from the specification. By itself this is no guarantee

[Haskell-cafe] Why is Cont out of scope?

2013-04-02 Thread Daryoush Mehrtash
I am trying to use the Cont in Control.Monad.Cont but it seems to be missing Prelude import Control.Monad.Cont Prelude Control.Monad.Cont :t Cont interactive:1:1: Not in scope: data constructor `Cont' Perhaps you meant `ContT' (imported from Control.Monad.Cont) Prelude Control.Monad.Cont

[Haskell-cafe] How to quantify the overhead?

2013-02-13 Thread Daryoush Mehrtash
Before I write the code I like to be able to quantify my expected result. But I am having hard time quantifying my expected result for alternative approaches in Haskell. I would appreciate any comments from experienced Haskell-ers on this problem: Suppose I have a big list of integers and I like

Re: [Haskell-cafe] need help with understanding expression

2012-11-16 Thread Daryoush Mehrtash
may be revealing: :t 3 2 On Fri, Nov 16, 2012 at 7:46 AM, Daryoush Mehrtash dmehrt...@gmail.comwrote: I see the point with :t (.) that max.(+1) 2 2 is the same as max. 3 2 Which is not what I want. But I have no idea what the type signature of this expression mean now Prelude

Re: [Haskell-cafe] need help with understanding expression

2012-11-16 Thread Daryoush Mehrtash
Sorry wrong paste Prelude :t 3 2 3 2 :: (Num a, Num (a - t)) = t What does the type mean in plain english? Daryoush On Fri, Nov 16, 2012 at 12:00 AM, Daryoush Mehrtash dmehrt...@gmail.comwrote: Yes, same problem, and again I have no idea how to read the type Prelude :t max. 3 2 max. 3 2

[Haskell-cafe] need help with understanding expression

2012-11-15 Thread Daryoush Mehrtash
I am having hard time understanding how removing the outer parenthesis in (max.(+1)) 2 2 to max.(+1) 2 2 changes the meaning of expression. My expectation was that max.(+1) takes two numbers and returns the max as defined in the type: :t max.(+1) max.(+1) :: (Ord b, Num b) = b - b - b

Re: [Haskell-cafe] need help with understanding expression

2012-11-15 Thread Daryoush Mehrtash
at 11:19 PM, Ramana Kumar ramana.ku...@cl.cam.ac.ukwrote: Hi Daryoush, I recommend you try these experiments first, and then reply back if you're still confused. :t max :t (+1) :t max . (+1) :t (+1) 2 :t (.) On Fri, Nov 16, 2012 at 7:10 AM, Daryoush Mehrtash dmehrt...@gmail.comwrote

[Haskell-cafe] Is there a tool to see reduction steps?

2012-10-10 Thread Daryoush Mehrtash
I have been given a piece of code that uses Tie-ing the Knot concept to label a tree of nodes in breath first manner. It seems to work fine, but I am having trouble expanding the code on my own to see the evaluation process. I like to know if there is a tools to use to see the reduction

Re: [Haskell-cafe] HANSEI in Haskell?

2011-02-28 Thread Daryoush Mehrtash
28, 2011 at 7:34 AM, Chung-chieh Shan ccs...@cs.rutgers.eduwrote: Daryoush Mehrtash dmehrt...@gmail.com wrote in haskell-cafe: I am confused about this comment: Mostly we preferred (as do the domain experts we target) to write probabilistic models in direct style rather than monadic

Re: [Haskell-cafe] HANSEI in Haskell?

2011-02-27 Thread Daryoush Mehrtash
that they prefer the first version over the 2nd version? thanks, Daryoush On Wed, Feb 23, 2011 at 7:52 AM, Chung-chieh Shan ccs...@cs.rutgers.eduwrote: Hello! Thank you for your interest. Daryoush Mehrtash dmehrt...@gmail.com wrote in haskell-cafe: Is the Embedded domain-specific language

Re: [Haskell-cafe] HANSEI in Haskell?

2011-02-23 Thread Daryoush Mehrtash
, Feb 23, 2011 at 7:52 AM, Chung-chieh Shan ccs...@cs.rutgers.eduwrote: Hello! Thank you for your interest. Daryoush Mehrtash dmehrt...@gmail.com wrote in haskell-cafe: Is the Embedded domain-specific language HANSEI for probabilistic models and (nested) inference described in: http

[Haskell-cafe] HANSEI in Haskell?

2011-02-20 Thread Daryoush Mehrtash
Is the Embedded domain-specific language HANSEI for probabilistic models and (nested) inference described in: http://okmij.org/ftp/kakuritu/index.html#implementation available in Haskell? Is there a reason why the author did the package in Ocaml rather than Haskell? -- Daryoush

Re: [Haskell-cafe] Are constructors strict?

2011-01-25 Thread Daryoush Mehrtash
at 7:52 PM, Daryoush Mehrtash dmehrt...@gmail.comwrote: loop = MonadPlus m = m Bool loop = loop If we apply Just to loop as follows test2 :: MonadPlus m = m (Maybe Bool) test2 = loop = return . Just the evaluation of test2 does not terminate because = has to evaluate loop

Re: [Haskell-cafe] Are constructors strict?

2011-01-21 Thread Daryoush Mehrtash
loop = MonadPlus m = m Bool loop = loop If we apply Just to loop as follows test2 :: MonadPlus m = m (Maybe Bool) test2 = loop = return . Just the evaluation of test2 does not terminate because = has to evaluate loop. But this does not correctly reflect the behaviour in a

[Haskell-cafe] Are constructors strict?

2011-01-20 Thread Daryoush Mehrtash
I am having hard time understanding the following paragraph in Purely functional Lazy non-deterministic programing paper http://www.cs.rutgers.edu/~ccshan/rational/lazy-nondet.pdf The problem with the naive monadic encoding of non-determinism is that the arguments to a constructor must be

[Haskell-cafe] Is this the right way to do polymorphism?

2011-01-07 Thread Daryoush Mehrtash
I am trying to evaluate the polymorphism technique used in Hackage library. I like to know if the approach taken is right or not. The code in question is in the Hoaut package http://hackage.haskell.org/package/hoauth/ As far as I can understand the code wants to have polymorphism on HTTP client

[Haskell-cafe] ; in do

2010-12-29 Thread Daryoush Mehrtash
Why do people put ; in do {}, or , in data fields, at the beginning of the line? -- Daryoush Weblog: http://onfp.blogspot.com/ ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] need help with syntax...

2010-12-06 Thread Daryoush Mehrtash
I am having hard time understanding the following code. The code is from Applicative Parser library: http://hackage.haskell.org/packages/archive/uu-parsinglib/2.5.5.2/doc/html/src/Text-ParserCombinators-UU-BasicInstances.html instance (Show a, loc `IsLocationUpdatedBy` a) = Provides (Str a

Re: [Haskell-cafe] fundata1 -- Karmic Social Capital Benchmark and Shootout

2010-10-29 Thread Daryoush Mehrtash
In the lessons you say: Haskell proved too slow with String Map, so we ended up interning strings and working with an IntMap and a dictionary to disintern back to strings as a last step. Daniel Fisher was instrumental in bringing Haskell up to speed with OCaml and then beating it. Don

[Haskell-cafe] What makes Haskell difficult as .NET?

2010-05-14 Thread Daryoush Mehrtash
In this presentation http://norfolk.cs.washington.edu/htbin-post/unrestricted/colloq/details.cgi?id=907 the speaker talks about F# on .Net platform. Early on in the talk he says that they did F# because haskell would be hard to make as a .Net language.Does anyone know what features of

Re: [Haskell-cafe] What makes Haskell difficult as .NET?

2010-05-14 Thread Daryoush Mehrtash
Would there be issues (lazy evaluation, type system...) with other languages calling a Haskell code in a hypothetical Haskell in .NET? Daryoush On Fri, May 14, 2010 at 10:43 AM, Don Stewart d...@galois.com wrote: dmehrtash: In this presentation

Re: [Haskell-cafe] Re: persist and retrieve of IO type?

2010-04-10 Thread Daryoush Mehrtash
Can you please explain this: the parameters baked into the thunk may be infinite daryoush On Sat, Apr 10, 2010 at 6:27 AM, Svein Ove Aas svein@aas.no wrote: On Sat, Apr 10, 2010 at 11:19 AM, Jon Fairbairn jon.fairba...@cl.cam.ac.uk wrote: It sounds more like he wants two

[Haskell-cafe] persist and retrieve of IO type?

2010-04-09 Thread Daryoush Mehrtash
Is there a way to persist a [IO ()] to say a file then retrieve it later and execute it using a sequence function? Thanks, Daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] How can i run darcs in ghci?

2010-02-15 Thread Daryoush Mehrtash
I am trying to load darc.hs (from darcs 2.3.1, ghci 6.10.4 on Ubuntu) and I get the following :~/darcs-src/darcs-2.3.1/src$ ghci GHCi, version 6.10.4: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking ... done. Loading

Re: [Haskell-cafe] How can i run darcs in ghci?

2010-02-15 Thread Daryoush Mehrtash
I am trying to understand darcs implementation. I can install the app using cabal, so now I want to load it in ghci to be able to play around with it. Any help on how to load the .h is greatly appreciated. I tried -i with path to the src directory but it didn't work (should it?). I am also

[Haskell-cafe] What is the difference between Strachey diff from Scott Semantic Domain?

2010-01-13 Thread Daryoush Mehrtash
On Stack overflow page Conal Elliot says: Beware that denotational semantics has two parts, from its two founders Christopher Strachey and Dana Scott: the easier more useful Strachey part and the harder and less useful (for design) Scott part.

Re: [Haskell-cafe] DSL in Haskell

2009-11-16 Thread Daryoush Mehrtash
Have you seen the Haskell School of Expression book by Paul Hudak? The book is available on line, Ch 9 and 10 talks about music. http://plucky.cs.yale.edu/cs431/HaskoreSoeV-0.7.pdf Daryoush On Mon, Nov 16, 2009 at 3:16 AM, CK Kashyap ck_kash...@yahoo.com wrote: Thanks Don, I read the

Re: Fwd: [Haskell-cafe] Haskell for Physicists

2009-10-13 Thread Daryoush Mehrtash
Of all the projects that are in the HackageDB, how many, or what % do you say developed an EDSL? daryoush On Tue, Oct 13, 2009 at 3:06 PM, Xiao-Yong Jin xj2...@columbia.edu wrote: Don Stewart d...@galois.com writes: Hey all, Following up on this, I'm presenting a position paper tomorrow

[Haskell-cafe] Any example of concurrent haskell application?

2009-10-08 Thread Daryoush Mehrtash
I am trying to learn more about concurrent applications in Haskell by studying an existing a real application source code. I would very much appreciate if you can recommend an application that you feel has done a good job in implementing a real time application in Haskell. Daryoush

[Haskell-cafe] What is the point of the 'What the bleep' names in haskell?

2009-07-17 Thread Daryoush Mehrtash
Why do Haskell programmers (and libraries) name their function like @ or ###?Why not use a more descriptive label for functions? Daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Functors and the Visitor Pattern

2009-06-03 Thread Daryoush Mehrtash
There was a google talk on Visitor pattern in Java and Common Lisp that you might find interesting http://www.youtube.com/watch?v=VeAdryYZ7ak Daryoush On Wed, Jun 3, 2009 at 6:10 AM, Tom.Amundsen tomamund...@gmail.com wrote: So, last night, I was having this problem with my Java code where I

Re: [Haskell-cafe] trying to understand space leaks....

2009-05-27 Thread Daryoush Mehrtash
:03 PM, Daryoush Mehrtash dmehrt...@gmail.com wrote: newtype Parser s a = P( [s] - Maybe (a, [s])) (fixed typo) instance MonadPlus Parser where P a mplus P b = P (\s - case a s of Just (x, s') - Just (x, s') Nothing - b s

Re: [Haskell-cafe] trying to understand space leaks....

2009-05-27 Thread Daryoush Mehrtash
on the value of e that could be determined to fail quickly, simple might actually do a lot of work, etc. But during the mplus in the monadic parser, we can't free e. -- ryan On Wed, May 27, 2009 at 12:49 PM, Daryoush Mehrtash dmehrt...@gmail.com wrote: So long as the [s] is a fixed list (say

[Haskell-cafe] trying to understand space leaks....

2009-05-26 Thread Daryoush Mehrtash
In Section 2.5 of Generalizing Monads to Arrows paper (linkhttp://www.cs.chalmers.se/%7Erjmh/Papers/arrows.ps) John Huges talks about the space leak inherit in monadic implementation of backtracking parsers. newtype Parser s a = P( [s] = Maybe (a, [s])) instance MonadPlus Parser where P

Re: [Haskell-cafe] Design in Haskell?

2009-05-26 Thread Daryoush Mehrtash
If you are coming from Object Oriented background, I think, the best book to read is the Paul Hudak's Haskell School of Expression. It goes through a design of a game application. The book is also available on line in google books. daryoush On Mon, May 25, 2009 at 1:22 AM, Dan

[Haskell-cafe] looking for suggestion on pattern matching problem

2009-05-14 Thread Daryoush Mehrtash
I am trying to analyze a list of items (say integers) for longest matches on patterns and their location on the list. One catch is that pattern may be defined in terms of other patterns. Example of patterns would be the any sequence of increasing numbers, or sequence of increasing numbers

[Haskell-cafe] forall vs =

2009-05-12 Thread Daryoush Mehrtash
What is the difference between forall as in: runSThttp://www.haskell.org/ghc/docs/6.10-latest/html/libraries/base/Control-Monad-ST.html#v%3ArunST:: ( forall s. SThttp://www.haskell.org/ghc/docs/6.10-latest/html/libraries/base/Control-Monad-ST.html#t%3ASTs a) - a and the = as in

[Haskell-cafe] Curry and Reader monad

2009-05-07 Thread Daryoush Mehrtash
In the Is currying monadic?http://greenokapi.net/blog/2009/05/07/is-currying-monadic/post the author says: This is again a nested expression. So I wondered if you could again flatten it with a monadic do block: let add3 = do a - get first parameter b - get second

Re: [Haskell-cafe] ANN: Silkworm game

2009-05-03 Thread Daryoush Mehrtash
I noticed that Chipmunk also has a Ruby interface. Do you have any pro/con of implementing the game in Ruby vs Haskell? Thanks, Daryoush On Sat, May 2, 2009 at 12:00 PM, Duane Johnson duane.john...@gmail.comwrote: Reprinted from my blog post [1]: === The semester is over, my final

[Haskell-cafe] Problem with installing phooey

2009-04-27 Thread Daryoush Mehrtash
When I try to install Phooey I get the following error: cabal install --constraint=Stream == 0.3 phooey Resolving dependencies... [1 of 1] Compiling Main ( /tmp/phooey-2.016943/phooey-2.0/Setup.lhs, /tmp/phooey-2.016943/phooey-2.0/dist/setup/Main.o ) Linking

[Haskell-cafe] old-time conflict when installing phooey

2009-04-26 Thread Daryoush Mehrtash
When I try to install phooey I get conflict with old-time that I am not sure how to resolve. Any ideas? cabal install phooey Resolving dependencies... cabal: dependencies conflict: ghc-6.10.1 requires old-time ==1.0.0.2 however old-time-1.0.0.2 was excluded because ghc-6.10.1 requires

Re: [Haskell-cafe] Functor and Haskell

2009-04-23 Thread Daryoush Mehrtash
/Natural_transformation On Wed, Apr 22, 2009 at 3:40 PM, Ross Paterson r...@soi.city.ac.uk wrote: On Wed, Apr 22, 2009 at 03:14:03PM -0700, Daryoush Mehrtash wrote: The Haskell Wikibooks also says the same thing: Functors in Haskell are from Hask to func, where func

Re: [Haskell-cafe] Functor and Haskell

2009-04-23 Thread Daryoush Mehrtash
is a natural transformation? Daryoush On Thu, Apr 23, 2009 at 12:34 PM, Dan Doel dan.d...@gmail.com wrote: On Thursday 23 April 2009 2:44:48 pm Daryoush Mehrtash wrote: Thanks for this example I get the point now. (at least i think i do :) ) One more question This all being on the same category

Re: [Haskell-cafe] Functor and Haskell

2009-04-22 Thread Daryoush Mehrtash
types. In this example I guess, the Singleton types are subset of List types which are subset of Hask. Is that related to natural transformation or unrelated? Daryoush On Wed, Apr 22, 2009 at 12:18 AM, Kim-Ee Yeoh a.biurvo...@asuhan.comwrote: Daryoush Mehrtash-2 wrote: I am not sure I

[Haskell-cafe] Functor and Haskell

2009-04-21 Thread Daryoush Mehrtash
In category theory functors are defined between two category of C and D where every object and morphism from C is mapped to D. I am trying to make sense of the above definition with functor class in Haskell. Let say I am dealing with List type. When I define List to be a instance of a functor

Re: [Haskell-cafe] Functor and Haskell

2009-04-21 Thread Daryoush Mehrtash
object (type) different from another. Daryoush Mehrtash wrote: In category theory functors are defined between two category of C and D where every object and morphism from C is mapped to D. I am trying to make sense of the above definition with functor class in Haskell. Let say I am dealing

Re: [Haskell-cafe] Issues with running Ghci from emacs

2009-04-16 Thread Daryoush Mehrtash
Thanks, that does the trick. Daryoush 2009/4/16 Patai Gergely patai_gerg...@fastmail.fm I end up doing :set -i../Documents/haskell/SOE/src To set the search directory so that ghci can find the source. I've not been how to tailor that 'cd' which is run at start up (but I've

[Haskell-cafe] Issues with running Ghci from emacs

2009-04-15 Thread Daryoush Mehrtash
I am having problem running GHCI with Haskell files that include imports. I am running emacs22 on Ubuntu, with haskell-mode-2.4 extensions. I load my file (Fal.lhs in this case) in emacs. Then try to run the Ghci by doing C-c C-l. The result is shown below. Ghci fails to find the Draw.lhs

[Haskell-cafe] tail recursion

2009-04-07 Thread Daryoush Mehrtash
Is the call to go in the following code considered as tail recursion? data DList a = DLNode (DList a) a (DList a) mkDList :: [a] - DList a mkDList [] = error http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:error must have at least one element mkDList xs = let (first,last

Re: [Haskell-cafe] Re: ANNOUNCE: vacuum-cairo: a cairo frontend to vacuum for live Haskell data visualization

2009-04-02 Thread Daryoush Mehrtash
When I try to install the hubigraph I get the following error: :~/Desktop/hubigraph-0.1$ cabal install Resolving dependencies... 'haxr-3000.1.1.2' is cached. Configuring haxr-3000.1.1.2... Preprocessing library haxr-3000.1.1.2... Building haxr-3000.1.1.2... [1 of 6] Compiling

[Haskell-cafe] Is there a way to see the equation reduction?

2009-03-31 Thread Daryoush Mehrtash
I am trying to write out the execution of the recursive calls in mkDList examplehttp:/http://www.haskell.org/haskellwiki/Tying_the_Knot/www.haskell.org/haskellwiki/Tying_the_Knotfor different size lists. Is there a way in ghc, or ghci where for a given list I can see the intermediate recursive

Re: [Haskell-cafe] Is there a way to see the equation reduction?

2009-03-31 Thread Daryoush Mehrtash
[1,2,3]) But I am more interested in seeing the expansion and reduction that the execution encounters as it lazily evaluates the function. Daryoush On Tue, Mar 31, 2009 at 6:49 PM, Bernie Pope florbit...@gmail.com wrote: 2009/4/1 Daryoush Mehrtash dmehrt...@gmail.com I am trying to write

Re: [Haskell-cafe] what does atomically# mean?

2009-03-20 Thread Daryoush Mehrtash
I am having hard time making sense of GHC.Conc. Is there a writeup that describes the significance of #, or the meaning of primOp and primType? Thanks Daryoush On Sun, Dec 7, 2008 at 11:48 PM, Don Stewart d...@galois.com wrote: dmehrtash: Any idea was the atomically# mean in the

Re: [Haskell-cafe] do you have to use fix with forkio?

2009-03-06 Thread Daryoush Mehrtash
Two questions: a) This chat server implementation doesn't actually close the connection as a real one would need to do. If you use forever is there a way to end the loop so as to end the connection? b) In Section 5 of this paper: http://www.cs.yale.edu/~hl293/download/leak.pdf Comparing

[Haskell-cafe] do you have to use fix with forkio?

2009-03-05 Thread Daryoush Mehrtash
In this chat server implementation http://www.haskell.org/haskellwiki/Implement_a_chat_server forkIO is used with fix as in: reader - forkIO $ http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:. fix $ http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#v:.

Re: [Haskell-cafe] MapReduce reverse engineered

2009-02-25 Thread Daryoush Mehrtash
Any idea how one might implement a multi note map and reduce network? Lets assume I have network of nodes that act as master and salve. How can I take a user code (containing his map reduce logic) and actually run it on different nodes? Daryoush 2009/2/24 Galchin, Vasili vigalc...@gmail.com

Re: [Haskell-cafe] MapReduce reverse engineered

2009-02-25 Thread Daryoush Mehrtash
since mapReduce assumes that all the code (and the data) is in place in the respective nodes. As far as I can tell, the Hadoop, the open source implementation of map reduce, doesn't require your map reduce code to be in all nodes. It copies the jar files of the your application to the nodes

Re: [Haskell-cafe] Paper draft: Denotational design with type class morphisms

2009-02-19 Thread Daryoush Mehrtash
May be I am reading it wrong Shouldn't the second instance in The instance's meaning is the meaning's instance be plural as meaning's instances rather than meaning's instance? I am reading it similar to the you are who you know saying. It seems to say that the meaning of your data types

Re: [Haskell-cafe] question on types

2009-02-18 Thread Daryoush Mehrtash
Thanks, this explanation is what I was looking for. Wikipeidia has an explanation on it also: http://en.wikipedia.org/wiki/System_F#System daryoush On Wed, Feb 18, 2009 at 2:08 AM, Stephan Friedrichs deduktionstheo...@web.de wrote: Daryoush Mehrtash wrote: Is there a way to define a type

[Haskell-cafe] question on types

2009-02-17 Thread Daryoush Mehrtash
Is there a way to define a type with qualification on top of existing type (e.g. prime numbers)? Say for example I want to define a computation that takes a prime number and generates a string. Is there any way I can do that in Haskell? thanks, Daryoush

[Haskell-cafe] Feynman on Mathematics and Physics

2009-02-15 Thread Daryoush Mehrtash
Just came across this 6 part video of Feynman lecture on relationship of mathematics and physics. http://www.youtube.com/watch?v=W1jIPzjFU_Ue Enjoy, Daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] IO semantics and evaluation - summary

2009-02-13 Thread Daryoush Mehrtash
I have been trying to figure out the distinction between value, function and computation. You raised a few points that I am not sure about. In Computation considered harmful. Value not so hot either. you said: I still don't like it; a lambda expression is not a computation, it's a formal

Fwd: [Haskell-cafe] ANN : happs-tutorial 0.7

2009-02-11 Thread Daryoush Mehrtash
When i try to cabal install happs-tutorial I get the following error: ghc: panic! (the 'impossible' happened) (GHC version 6.10.1 for i386-unknown-linux): RegAllocLinear.getStackSlotFor: out of stack slots, try -fregs-graph Please report this as a GHC bug:

Re: [Haskell-cafe] Re: Monad explanation

2009-02-05 Thread Daryoush Mehrtash
Can someone compare/contrast functions and computation? thanks daryoush On Thu, Feb 5, 2009 at 1:38 AM, Benjamin L. Russell dekudekup...@yahoo.comwrote: On Wed, 4 Feb 2009 21:43:04 -0800, Max Rabkin max.rab...@gmail.com wrote: On Wed, Feb 4, 2009 at 9:38 PM, Benjamin L. Russell

Re: [Haskell-cafe] what does atomically# mean?

2009-01-30 Thread Daryoush Mehrtash
I like to look at the code where the runtime detects a TVar, inside an atomic block, has been changed by another thread and hence it aborts the atomic operation. Any suggestion as to where I would find the code? daryoush On Sun, Dec 7, 2008 at 10:48 PM, Don Stewart d...@galois.com wrote:

[Haskell-cafe] Is it possible to model eventually consistent side effects?

2009-01-22 Thread Daryoush Mehrtash
I am trying to figure out if there is a way to model cloud computing computations in Haskell. My specific problems is that in cloud computing, as in Amazon WebServices, side effects (writes to storage, simple database, queue) follow the eventually consistent model. Which means even if your

[Haskell-cafe] MonadTrans lift implementation

2009-01-19 Thread Daryoush Mehrtash
Is there a reason why the lift function in ReaderT's MonadTrans instance is implemented as: instance MonadTrans (ReaderT r) where lift m = ReaderT $ \_ - m Instead of just using the monad's return function? Could lift m be implemented as return m? instance (Monad m) = Monad (ReaderT

[Haskell-cafe] Adding Authentication and Authorization to a service implemented in Haskell

2009-01-13 Thread Daryoush Mehrtash
I am trying to figure out a clean way to add authentication and authorization in a webservice. The services of the web services are implemented as Haskell functions. The request to the service contains the user authentication information. I want to authenticate the user by verifying his

[Haskell-cafe] what does atomically# mean?

2008-12-07 Thread Daryoush Mehrtash
Any idea was the atomically# mean in the following code? atomically :: STM a - IO a atomically (STM m) = IO (\s - (*atomically# *m) s ) Code is from GHC.Conc module http://www.haskell.org/ghc/docs/6.6/html/libraries/base/GHC-Conc.html daryoush ___

Re: [Haskell-cafe] foldl vs foldl'

2008-11-05 Thread Daryoush Mehrtash
Daryoush Mehrtash: Are there cases (function or list) where the result of foldl (or foldr)would be different that foldl' (or foldr')? thanks, daryoush Simple example: import Data.List weird :: Int - Int - Int weird _ 0 = 0 weird x y = x*y list :: [Int] list = [1, 2, 3, 4, undefined, 6

[Haskell-cafe] foldl vs foldl'

2008-11-04 Thread Daryoush Mehrtash
Are there cases (function or list) where the result of foldl (or foldr)would be different that foldl' (or foldr')? thanks, daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] computational overhead of the data declarations

2008-10-28 Thread Daryoush Mehrtash
I Haskell School of Expression (p172), it says: A newtype declaration is just like a data declaration, except that it can only be used to defined data types with single constructor. The new data type is different from the analogous one created by a data declaration, in that there is no

Re: [Haskell-cafe] computational overhead of the data declarations

2008-10-28 Thread Daryoush Mehrtash
Daryoush On Tue, Oct 28, 2008 at 1:08 PM, Brent Yorgey [EMAIL PROTECTED]wrote: On Tue, Oct 28, 2008 at 12:13:11PM -0700, Daryoush Mehrtash wrote: I Haskell School of Expression (p172), it says: A newtype declaration is just like a data declaration, except that it can only be used

[Haskell-cafe] need help making sense of the relative indexing

2008-10-20 Thread Daryoush Mehrtash
I am trying to make sense of the relative indexing example used in this Charting Patterns on Price history paper: http://serv1.ist.psu.edu:8080/viewdoc/download;jsessionid=CC3DEF7277760C535FE3AB7C51A2BE90?doi=10.1.1.21.6892rep=rep1type=pdf In Section 3 it defines: type Indicator a = Bar →

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Daryoush Mehrtash
The best analogy I have found on Monads (written for Scala) is the one that compared them to Elephants. The author was referring the the blind men and elephant story: http://en.wikipedia.org/wiki/Blind_Men_and_an_Elephant On Wed, Oct 15, 2008 at 6:40 PM, Derek Elkins [EMAIL PROTECTED]wrote:

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-16 Thread Daryoush Mehrtash
away from '?', and stick to type variables with Java generics, though, how type checking with generics works in Java should be mostly unsurprising to a Haskeller. Oh, good. Daryoush Mehrtash: It looks like the answer to your original question --- gotchas with Java generics vs. Haskell

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Daryoush Mehrtash
The equivalent won't compile in Haskell, because the actual return type does matter, and *is determined by the calling code*. Our fictional GetListOfData can't return a List or a Mylist depending on some conditional, in fact it can't explicitly return either one at all, because the actual

Re: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Daryoush Mehrtash
, Jonathan Cast [EMAIL PROTECTED]wrote: On Wed, 2008-10-15 at 11:56 -0700, Daryoush Mehrtash wrote: The equivalent won't compile in Haskell, because the actual return type does matter, and *is determined by the calling code*. Our fictional

Re: Re[2]: [Haskell-cafe] Re: What I wish someone had told me...

2008-10-15 Thread Daryoush Mehrtash
I am having hard time understanding this statement: Haskell types lack constructors, so the user never expects to be able to conjure up a value of an unknown type. I am not sure how say in a Java language a constructor can conjure up a value of an unknown type. daryoush On Wed, Oct 15, 2008

[Haskell-cafe] couple of questions on monads

2008-10-13 Thread Daryoush Mehrtash
Question 1: Why are there lazy and strict modules of some monads? (e.g. Control.monad.State) Question 2: If I define a new monad (say xyz), does it have to be as control.monad.xyz module? daryoush ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] couple of questions on monads

2008-10-13 Thread Daryoush Mehrtash
a - s - m a evalStateT m s = do ~(a, _) - runStateT m s return a What does ~ do? thanks, Daryoush On Mon, Oct 13, 2008 at 1:34 PM, Jonathan Cast [EMAIL PROTECTED]wrote: On Mon, 2008-10-13 at 13:37 -0700, Daryoush Mehrtash wrote: Question 1: Why are there lazy and strict modules

Re: [Haskell-cafe] [] vs [()]

2008-10-10 Thread Daryoush Mehrtash
function f. daryoush On Fri, Oct 10, 2008 at 10:56 AM, Jonathan Cast [EMAIL PROTECTED]wrote: On Fri, 2008-10-10 at 10:59 -0700, Daryoush Mehrtash wrote: I was in fact trying to figure out how guard worked in the do. The interesting (for a beginner) insight is that: [()] map f

Re: [Haskell-cafe] [] vs [()]

2008-10-10 Thread Daryoush Mehrtash
I was in fact trying to figure out how guard worked in the do.The interesting (for a beginner) insight is that: [()] map f = [f] --( just as any list with one element would have been such as [1] map f = [f] ) where as [] map f = [] so if your guard computes to [()] (or any list of

[Haskell-cafe] how do you deal with mplus?

2008-10-09 Thread Daryoush Mehrtash
Assuming A, B, C are monadic operation. How do you read the following function: do A 'mplus' B C I expect this to translate to: (A 'mplus' B) = C Can I then say it is equivalent to: (A =C) mplus (B =C) Thanks, Daryoush

[Haskell-cafe] [] vs [()]

2008-10-09 Thread Daryoush Mehrtash
What is the difference between empty list [] and list with one unit element [()]? daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Haskell board game

2008-09-24 Thread Daryoush Mehrtash
check out http://www.haskell.org/soe/ On Wed, Sep 24, 2008 at 7:23 PM, Tim Docker [EMAIL PROTECTED] wrote: I'm interested in doing a simple board game on haskell. For that I want to be able to draw stuff like the possible player movements and I want to be able to display very simple

[Haskell-cafe] need help making sense of the type ...

2008-09-24 Thread Daryoush Mehrtash
I am having hard time making sense of the types in the following example from the Applicative Programming paper: http://www.cs.nott.ac.uk/~ctm/IdiomLite.pdf ap :: Monad m ⇒ m (a → b ) → m a → m b ap mf mx = do f ← mf x ← mx return (f x ) Using this function we could rewrite sequence

Re: [Haskell-cafe] Semantic Domain, Function, and denotational model.....

2008-09-17 Thread Daryoush Mehrtash
:13:53 -0700 From: Daryoush Mehrtash [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Semantic Domain, Function, and denotational model. To: Ryan Ingram [EMAIL PROTECTED] Cc: Haskell Cafe haskell-cafe@haskell.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain; charset

Re: [Haskell-cafe] Semantic Domain, Function, and denotational model.....

2008-09-16 Thread Daryoush Mehrtash
work. This drives the design of the entire library, with similar morphisms over many typeclasses between Event and E, Reactive and B, etc. -- ryan On Mon, Sep 15, 2008 at 10:13 AM, Daryoush Mehrtash [EMAIL PROTECTED] wrote: Interestingly, I was trying to read his paper when I realized that I

Re: [Haskell-cafe] Semantic Domain, Function, and denotational model.....

2008-09-16 Thread Daryoush Mehrtash
Daryoush Mehrtash [EMAIL PROTECTED]: ّ I don't follow the at and type B a. Behavior a itself is a time function. At least in the version of the code that was developed in Pual Hudak's Haskell School of Expression it was defined as: newtype Behavior a = Behavior (([Maybe UserAction

Re: [Haskell-cafe] Re: Proofs and commercial code -- was Haskell Weekly News: Issue 85 - September 13, 2008

2008-09-15 Thread Daryoush Mehrtash
Sep 2008 22:24:50 -0700 From: Daryoush Mehrtash [EMAIL PROTECTED] Subject: Re: [Haskell-cafe] Haskell Weekly News: Issue 85 - September 13, 2008 To: Don Stewart [EMAIL PROTECTED] Cc: Haskell Cafe haskell-cafe@haskell.org Message-ID: [EMAIL PROTECTED] Content-Type: text/plain

Re: [Haskell-cafe] Semantic Domain, Function, and denotational model.....

2008-09-15 Thread Daryoush Mehrtash
-reactive -- ryan On Sun, Sep 14, 2008 at 11:31 AM, Daryoush Mehrtash [EMAIL PROTECTED] wrote: I have been told that for a Haskell/Functional programmer the process of design starts with defining Semantic Domain, Function, and denotational model of the problem. I have done some googling

[Haskell-cafe] Semantic Domain, Function, and denotational model.....

2008-09-14 Thread Daryoush Mehrtash
I have been told that for a Haskell/Functional programmer the process of design starts with defining Semantic Domain, Function, and denotational model of the problem. I have done some googling on the topic but haven't found a good reference on it.I would appreciate any good references on the

Re: [Haskell-cafe] Haskell Weekly News: Issue 85 - September 13, 2008

2008-09-13 Thread Daryoush Mehrtash
What I am trying to figure out is that say on the code for the IRC bot that is show here http://www.haskell.org/haskellwiki/Roll_your_own_IRC_bot/Source What would theorem proofs do for me? Daryoush On Sat, Sep 13, 2008 at 9:29 PM, Don Stewart [EMAIL PROTECTED] wrote: dmehrtash: I have

Re: [Haskell-cafe] Re: Haskell and Java

2008-09-10 Thread Daryoush Mehrtash
Daryoush Mehrtash a écrit : Why do you want to mix haskall and Java in one VM? If there are functionality within your code that is better implemented in haskell, then why not make that into a service (run it as haskell) with some api that Java code can use. Daryoush On Tue, Sep 9, 2008 at 2:36

[Haskell-cafe] trying to understand monad transformers....

2008-09-09 Thread Daryoush Mehrtash
The MaybeT transformer is defined as: newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Maybe a)} instance Functor http://haskell.org/ghc/docs/latest/html/libraries/base/Prelude.html#t:Functor m = Functor

Re: [Haskell-cafe] Haskell and Java

2008-09-09 Thread Daryoush Mehrtash
Why do you want to mix haskall and Java in one VM? If there are functionality within your code that is better implemented in haskell, then why not make that into a service (run it as haskell) with some api that Java code can use. Daryoush On Tue, Sep 9, 2008 at 2:36 AM, Maurí­cio [EMAIL

[Haskell-cafe] Field names

2008-09-08 Thread Daryoush Mehrtash
In type section of the Gentle Introduction to Haskell http://www.cs.sfu.ca/CC/SW/Haskell/hugs/tutorial-1.4-html/moretypes.htmlthere is this example: data Point = Pt {pointx, pointy :: Float} abs (Pt {pointx = x, pointy = y}) = sqrt (x*x + y+y) Why is it pointx=x and not x=pointx? --

Re: [Haskell-cafe] Re: Field names

2008-09-08 Thread Daryoush Mehrtash
Thanks. Pattern matching and memory management in Haskell (or may be GHC implementation of it) is somewhat of a mystery to me. Are there any references that explains the underlying implementation? Daryoush On Mon, Sep 8, 2008 at 6:37 PM, Mauricio [EMAIL PROTECTED] wrote: abs (Pt {pointx

Re: [Haskell-cafe] String to Double conversion in Haskell

2008-08-26 Thread Daryoush Mehrtash
: 2008/8/24 Daryoush Mehrtash [EMAIL PROTECTED]: I am trying to convert a string to a float. It seems that Data.ByteString library only supports readInt.After some googling I came accross a possibloe implementation: http://sequence.svcs.cs.pdx.edu/node/373 My questions

  1   2   >