[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 > guarante

[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 :1:1: Not in scope: data constructor `Cont' Perhaps you meant `ContT' (imported from Control.Monad.Cont) Prelude Control.Monad.Cont> :t runCo

[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
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 wrote: > Yes, same problem, and again I have no idea how to read the type > > Prelude> :t max. 3 2

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

2012-11-16 Thread Daryoush Mehrtash
ment may be revealing: > > :t 3 2 > > > > On Fri, Nov 16, 2012 at 7:46 AM, Daryoush Mehrtash wrote: > >> I see the point with :t (.) that >> >> max.(+1) 2 2 >> >> is the same as >> >> max. 3 2 >> >> Which is not what I want

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

2012-11-15 Thread Daryoush Mehrtash
h On Thu, Nov 15, 2012 at 11:19 PM, Ramana Kumar wrote: > 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 (.) > > >

[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

[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 steps.

Re: [Haskell-cafe] HANSEI in Haskell?

2011-02-28 Thread Daryoush Mehrtash
sh On Mon, Feb 28, 2011 at 7:34 AM, Chung-chieh Shan wrote: > Daryoush Mehrtash 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 rathe

Re: [Haskell-cafe] HANSEI in Haskell?

2011-02-27 Thread Daryoush Mehrtash
else dist [] By domain expert preferring direct style do you mean that they prefer the first version over the 2nd version? thanks, Daryoush On Wed, Feb 23, 2011 at 7:52 AM, Chung-chieh Shan wrote: > Hello! Thank you for your interest. > > Daryoush Mehrtash wrote in haskell-cafe

Re: [Haskell-cafe] HANSEI in Haskell?

2011-02-23 Thread Daryoush Mehrtash
ith an example? Thanks Daryoush On Wed, Feb 23, 2011 at 7:52 AM, Chung-chieh Shan wrote: > Hello! Thank you for your interest. > > Daryoush Mehrtash wrote in haskell-cafe: > > Is the "Embedded domain-specific language HANSEI for probabilistic models > > and (nest

[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
wrote: > Hi Daryoush, > > On Fri, Jan 21, 2011 at 7:52 PM, Daryoush Mehrtash wrote: > >> >> loop = MonadPlus m => m Bool >>> >> loop = loop >>> >> >>> If we apply Just to loop as follows >>> >> >>> test2 ::

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 behaviou

[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 deter

[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 l

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 Stew

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 wrote: > dmehrtash: > > In this presentation > > > > > http://norfolk.cs.washington.edu/htbin-post/unres

[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 Has

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 wrote: > On Sat, Apr 10, 2010 at 11:19 AM, Jon Fairbairn > wrote: > > It sounds more like he wants two functions something like > > > > save::

[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

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 v

[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 packa

[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. > http://stackoverflow.com/questions/1028250

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 wrote: > Thanks Don, > > I read the PDF. I was not able t

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 wrote: > Don Stewart writes: > > > Hey all, > > > > Following up on this, I'm presenting a position paper tomorrow on the > > use of EDSLs to

[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-caf

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 wrote: > > So, last night, I was having this problem with my Java code where I > couldn't > figure

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

2009-05-27 Thread Daryoush Mehrtash
ee it much more quickly. > > This example can be made arbitrarily more complicated; withExpensive > could run different things based 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&qu

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

2009-05-27 Thread Daryoush Mehrtash
to be able to back track on computation that needs and IO computation data.What would be approximate space that an IO (Char) computation take on the heap, is it few bytes, 100, 1k, ? Daryoush On Tue, May 26, 2009 at 6:11 PM, Ryan Ingram wrote: > On Tue, May 26, 2009 at 5:03 PM,

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 wrote: > H

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

2009-05-26 Thread Daryoush Mehrtash
In Section 2.5 of "Generalizing Monads to Arrows" paper (link) 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

[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 foll

[Haskell-cafe] forall vs "=>"

2009-05-12 Thread Daryoush Mehrtash
What is the difference between forall as in: runST:: ( forall s. STs a) -> a and the "=>" as in evalStat

[Haskell-cafe] Curry and Reader monad

2009-05-07 Thread Daryoush Mehrtash
In the 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 seco

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 wrote: > Reprinted from my blog post [1]: > > === > > The semester is over, my final project was a success (at

[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 /tmp/phooey-2.016943/pho

[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 old-tim

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 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

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 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 is the &

Re: [Haskell-cafe] Functor and Haskell

2009-04-22 Thread Daryoush Mehrtash
D's, D1 that is all List types, and D2 all singleton 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 wrote: > > >

Re: [Haskell-cafe] Functor and Haskell

2009-04-21 Thread Daryoush Mehrtash
m natural, since there is no > method to treat one 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

[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] Issues with running Ghci from emacs

2009-04-16 Thread Daryoush Mehrtash
Thanks, that does the trick. Daryoush 2009/4/16 Patai Gergely > > 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 not looked t

[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 "must have at least one element" mkDList xs = let (first,

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 Network.XmlRpc.DTD_X

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

2009-03-31 Thread Daryoush Mehrtash
With the debugger I can see the calls that are made when I run: takeF 2 (mkDList [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 wrote: &g

[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://www.haskell.org/haskellwiki/Tying_the_Knot/www.haskell.org/haskellwiki/Tying_the_Knot>for different size lists. Is there a way in ghc, or ghci where for a given list I can see the intermediate recursive and eval

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 wrote: > dmehrtash: > >Any idea was the atomically# mean in the following cod

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 t

[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 $ fix $

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 no

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 > Hello, > > He

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 d

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

[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_U&e Enjoy, Daryoush ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinf

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 for

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: http://www.haskell.org/ghc/repor

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 wrote: > On Wed, 4 Feb 2009 21:43:04 -0800, Max Rabkin > wrote: > > >On Wed, Feb 4, 2009 at 9:38 PM, Benjamin L. Russell > > wrote: > >> Is it possible to write a self-re

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 wrote: > dmehrtash: > >

[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 wr

[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 (Rea

[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 authen

[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 ___ Ha

[Haskell-cafe] Deriving

2008-12-02 Thread Daryoush Mehrtash
What happens when a type adds driving such as: newtype SupplyT s m a = SupplyT (StateT [s] m a) deriving (Functor , Monad , MonadTrans, M

Re: [Haskell-cafe] foldl vs foldl'

2008-11-05 Thread Daryoush Mehrtash
2008 00:08 schrieb 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

[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

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

2008-10-28 Thread Daryoush Mehrtash
on type to another? Thanks 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 jus

[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 com

[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.6892&rep=rep1&type=pdf In Section 3 it defines: type Indicator a = Bar → (

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

2008-10-16 Thread Daryoush Mehrtash
ant to disallow that call to wrong, in Haskell > > > you can... > > > > > > > Not exactly... Java disallows 'wrong' from being written (without > > class casts and such), because it disallows calling a method which has > > a wildcard type in a contra

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-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, 20

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

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 act

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

2008-10-13 Thread Daryoush Mehrtash
> StateT s m 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: > > Ques

[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 Haskell-Cafe@haskell.or

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

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

2008-10-10 Thread Daryoush Mehrtash
element, the element being 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"

[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

[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] 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 a

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 ani

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

2008-09-17 Thread Daryoush Mehrtash
"denotational" models to just > this -- whenever you have some compositionally defined map from one > representation to another that respects some form of equivalence, the target > is viewed as the denotation. > > Best wishes, > > --greg > > Date: Mon, 15 Sep 2008

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

2008-09-16 Thread Daryoush Mehrtash
where (t,x) = force z >> force (pure x) = (minBound, x) >> force (ff <*> fx) = (max tf tx, f x) where (tf, f) = force ff ; (tx, >> x) = force fx >> force (return x) = (minBound, x) >> force (m >>= f) = (max tm tx, x) where (tm, v) = force m; (tx, x) = force >

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

2008-09-16 Thread Daryoush Mehrtash
semantic) Functor Behavior where >>fmap f . at = at . fmap f > > As long as you as the user can think about behaviors generally as > functions of Time, you can ignore the implementation details, and > things that you expect to work should work. This drives the design of &

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

2008-09-15 Thread Daryoush Mehrtash
> > http://www.conal.net/papers/simply-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, F

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

2008-09-14 Thread Daryoush Mehrtash
he proof of the 4-color theorem. > The proof -- last i checked -- required programmatic checking of many cases. > Proving the program -- that implements the tedious parts of the proof -- > correct is pursued because of the culture and standard of mathematical > proof. > > Best wishes,

[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 t

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 h

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

2008-09-13 Thread Daryoush Mehrtash
I have a newbie question Does theorem proofs have a use for an application? Take for example the IRC bot example ( http://www.haskell.org/haskellwiki/Roll_your_own_IRC_bot) listed below. Is there any insight to be gained by theorem proofs (as in COQ) into the app? Thanks, Daryoush On Sat

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

2008-09-10 Thread Daryoush Mehrtash
K. It just would be easier if we > could join everything in a single piece, > but it is no big deal. > > Maurício > > 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

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 PROTEC

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

2008-09-08 Thread Daryoush Mehrtash
The MaybeT transformer is defined as: newtype MaybeT m a = MaybeT {runMaybeT :: m (Maybe a)} instance Functor m => Functor

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 {poi

  1   2   >