[Haskell-cafe] ANNOUNCE: hydra-print-0.1.0.0
Hello cafe, This is an NCurses front end for visualizing a dynamic collection of text streams (e.g. as produced by make -j or cabal -j). It just splits the window when more streams appear. http://hackage.haskell.org/package/hydra-print http://parfunk.blogspot.com/2013/04/hydra-print.html Right now I'm using it for the monad-par benchmark script, but I hope to provide a cabal patch soon. Cheers, -Ryan ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] GSoC Project Proposal: Markdown support for Haddock
+1 for concistency. Also, consider interop with non-haskell environments. For example showing the documentation of a function in emacs, eclipse, on github, and from a javascript library. All of these can be engineered around, and tooling can be provided. But let me give an example: the other week I was looking for a command-line tool to extract javadoc to display as contextual information in emacs. There is no such tool. Javadoc is java only. For me, if I could not hack it up in an hour, it was too much work. The solution was rather to craft a specific google search, use I'm feeling lucky, and extract the subsection containing the documentation for the function. Often the most useful format for documentation is contextual help in an IDE/editor, so don't forget that use-case. Alexander On Sat, Apr 6, 2013 at 1:04 AM, John MacFarlane j...@berkeley.edu wrote: I like markdown and use it all the time. While I acknowledge the problems that have been pointed out, markdown has the advantage of being easily readable as it is in the source document, and not looking like markup. But I do want to point out one problem with markdown as a format for documentation in Haskell files. Consider: module MyModule {- # Introduction This is my module -} where import System.Environment main = getArgs = print Now try to compile with -cpp, and you'll get an error because of the '#' in column 1. '#' in column 1 is common in markdown (and even indispensible for level 3+ headers). One could work around this by disallowing level 3+ headers, by allowing the headers to be indented, or by introducing new setext-like syntax for level 3+ headers, but it is a problem for the idea of using a markdown SUPERset. John +++ dag.odenh...@gmail.com [Apr 05 13 21:59 ]: I forgot the mention the craziness with the *significant trailing whitespace*. On Fri, Apr 5, 2013 at 9:49 PM, [1]dag.odenh...@gmail.com [2]dag.odenh...@gmail.com wrote: Personally I think Markdown sucks, although perhaps less than Haddock markup. Still: * No document meta data * No code block meta data like language for syntax highlighting * No tables * No footnotes * HTML fallback is insecure * Confusing syntax (is it []() or ()[] for links?) * Syntax that gets in the way (maybe I don't want *stars* emphasized) * Above point leads to non-standard dialects like GitHub Markdown (no, GitHub doesn't use markdown) * Not extensible, leading to even more non-standard hacks and work-arounds (GitHub Markdown, Pandoc Markdown, other Markdown libraries have their own incompatible extensions) * Not well suited for web input (e.g. four-space indentation for code blocks), although not that important for Haddock An important thing to note here is that no, Markdown has *not* won because no one is actually using *Markdown*. They're using their own, custom and incompatible dialects. Only two of the above points apply to reStructuredText (web input and syntax getting in the way), and those particular points don't apply to Creole. Therefore I tend to advocate Creole for web applications and reStructuredText for documents. On Thu, Apr 4, 2013 at 6:49 PM, Johan Tibell [3]johan.tib...@gmail.com wrote: Hi all, Haddock's current markup language leaves something to be desired once you want to write more serious documentation (e.g. several paragraphs of introductory text at the top of the module doc). Several features are lacking (bold text, links that render as text instead of URLs, inline HTML). I suggest that we implement an alternative haddock syntax that's a superset of Markdown. It's a superset in the sense that we still want to support linkifying Haskell identifiers, etc. Modules that want to use the new syntax (which will probably be incompatible with the current syntax) can set: {-# HADDOCK Markdown #-} on top of the source file. Ticket: [4]http://trac.haskell.org/haddock/ticket/244 -- Johan ___ Haskell-Cafe mailing list [5]Haskell-Cafe@haskell.org [6]http://www.haskell.org/mailman/listinfo/haskell-cafe References 1. mailto:dag.odenh...@gmail.com 2. mailto:dag.odenh...@gmail.com 3. mailto:johan.tib...@gmail.com 4. http://trac.haskell.org/haddock/ticket/244 5. mailto:Haskell-Cafe@haskell.org 6. http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___
Re: [Haskell-cafe] ANNOUNCE: hydra-print-0.1.0.0
Hi, Am Samstag, den 06.04.2013, 03:09 -0400 schrieb Ryan Newton: This is an NCurses front end for visualizing a dynamic collection of text streams (e.g. as produced by make -j or cabal -j). It just splits the window when more streams appear. http://hackage.haskell.org/package/hydra-print http://parfunk.blogspot.com/2013/04/hydra-print.html Right now I'm using it for the monad-par benchmark script, but I hope to provide a cabal patch soon. just FYI, there is a related library, http://hackage.haskell.org/package/concurrentoutput, that will not split the view but interleave the lines of each thread as they finish, but append additional data before the newline (e.g. .) to the right line. Greetings, Joachim -- Joachim nomeata Breitner Debian Developer nome...@debian.org | ICQ# 74513189 | GPG-Keyid: 4743206C JID: nome...@joachim-breitner.de | http://people.debian.org/~nomeata signature.asc Description: This is a digitally signed message part ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Error when building executable with profiling enabled
I switched to profiling through Cabal as you suggested, but now I have the error: bench\HLogo\Custom\Custom.hs:1:1: cannot find normal object file `dist\build\custom\custom-tmp\Framework\Keyword.o' while linking an interpreted expression So, I removed managing the executables directly from Cabal (--enable-executable-profiling) , and only enabled library profiling. Then I manually compiled each executable twice as: ghc --make Custom.hs ghc --make -prof -osuf p_o Custom.hs Profiling now works. Thank you. Regards, Nikos ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] My first Haskell program
Hello, Cafe I'm new to Haskell and the mailing list, and am wondering if I could get some feedback on my first program -- a Markov text generator. The code is posted here:http://codereview.stackexchange.com/questions/24791/haskell-markov-text-generator Thanks, John; ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] code-as-config, run-time checks and error locations
Dear Café, I'm working on a EDSL that will include both type checks (at compile time) and semantic checks (at run time). - Semantic properties are known at compile time but feel too complex to me to be encoded in the type system. If one of the runtime checks fails, I'd like to print the location of the error, i.e. not Error: Unknown field `AMOUNT' in table `ENTRIES' (where? why?) but Error: Unknown field `AMOUNT' in table `ENTRIES' Referenced at analysis1.hs:43:7 by `sumByInvoice' which was called at analysis1.hs:66:3 by `main' ENTRIES defined at analysis1.hs:13:8 I'm not yet sure which level of granularity I want for error messages and one can probably get arbitrarily fancy on this. For the moment I think it would be enough to auto-insert the location of calls to a certain set of functions. Any experience on this? Thanks a lot. -- Steffen ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] meaning of referential transparency
Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the meaning of reference and transparency in a dictionary, but I don't know why these words were chosen as name for this defined property. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code-as-config, run-time checks and error locations
On Sun, Apr 7, 2013 at 12:23 AM, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: For the moment I think it would be enough to auto-insert the location of calls to a certain set of functions. Have you tried assert [1]? [1] http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Control-Exception.html#v:assert -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] meaning of referential transparency
* Henning Thielemann lemm...@henning-thielemann.de [2013-04-06 19:43:45+0200] Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the meaning of reference and transparency in a dictionary, but I don't know why these words were chosen as name for this defined property. There has been a long discussion of RT a couple of years ago (?), which originated at StackOverflow and moved to cafe. I'd enjoy re-reading it if someone digs it up... Roman ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Fwd: meaning of referential transparency
On Sat, Apr 6, 2013 at 10:43 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the meaning of reference and transparency in a dictionary, but I don't know why these words were chosen as name for this defined property. Willard V.O. Quine Referential transparency arises in constrast to referential opacity. A context is referentially opaque (reference can't see through the context) when the substitution of equal values are not necessarily equal. For example, quotation marks are referentially opaque: It is necessary that four and four is eight The number of planets is eight If these contexts were referentially transparent, we would find that It is necessary that the number of planets is eight, a situation which at the very least puts us in a tight ontological position. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] meaning of referential transparency
On Sun, Apr 7, 2013 at 12:43 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the meaning of reference and transparency in a dictionary, but I don't know why these words were chosen as name for this defined property. Instead of a immaculately precise definition, may I suggest going about it from the practical benefits POV? RT matters so much in Haskell because of the engineering leverage it gives us. Bird's Pearls are a good source of Why Equational Reasoning Matters. -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code-as-config, run-time checks and error locations
Hi Steffen, most of the time I'm just using these cpp macros: #define __POS__(__FILE__ ++ : ++ show __LINE__) #define ERROR error $ __POS__ ++ - ++ Instead of writing 'error blub' you would write 'ERROR blub' and additionally get the file name and the line. There's a bracktracing functionality in the more recent versions of ghc. I think it has been discussed on this mailing list. Greetings, Daniel ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] meaning of referential transparency
Links SO: http://stackoverflow.com/questions/210835/what-is-referential-transparency Reddit discussions of said SO question. http://www.reddit.com/r/haskell/comments/x8rr6/uday_reddy_on_referential_transparency_and_fp/ http://www.reddit.com/r/haskell/comments/xgq27/uday_reddy_sharpens_up_referential_transparency/ This was a fascinating exchange and I'm glad to be reminded to revisit it :). On Sat, Apr 6, 2013 at 11:13 AM, Kim-Ee Yeoh k...@atamo.com wrote: On Sun, Apr 7, 2013 at 12:43 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the meaning of reference and transparency in a dictionary, but I don't know why these words were chosen as name for this defined property. Instead of a immaculately precise definition, may I suggest going about it from the practical benefits POV? RT matters so much in Haskell because of the engineering leverage it gives us. Bird's Pearls are a good source of Why Equational Reasoning Matters. -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] meaning of referential transparency
I have quite a detailed discussion of this concept, and related concepts, in Section 2.8 of my PhD thesis ( https://www.cs.tcd.ie/Edsko.de.Vries/pub/MakingUniquenessTypingLessUnique-screen.pdf ). -E On Sat, Apr 6, 2013 at 7:13 PM, Kim-Ee Yeoh k...@atamo.com wrote: On Sun, Apr 7, 2013 at 12:43 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the meaning of reference and transparency in a dictionary, but I don't know why these words were chosen as name for this defined property. Instead of a immaculately precise definition, may I suggest going about it from the practical benefits POV? RT matters so much in Haskell because of the engineering leverage it gives us. Bird's Pearls are a good source of Why Equational Reasoning Matters. -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] meaning of referential transparency
Should probably include the Reddit convo ongoing as we speak (zomg, it's live!): http://www.reddit.com/r/haskell/comments/1bsitm/lazy_io_breaks_equational_reasoning/ Not everyone here is a regular there. -- Kim-Ee On Sun, Apr 7, 2013 at 1:21 AM, Eli Frey eli.lee.f...@gmail.com wrote: Links SO: http://stackoverflow.com/questions/210835/what-is-referential-transparency Reddit discussions of said SO question. http://www.reddit.com/r/haskell/comments/x8rr6/uday_reddy_on_referential_transparency_and_fp/ http://www.reddit.com/r/haskell/comments/xgq27/uday_reddy_sharpens_up_referential_transparency/ This was a fascinating exchange and I'm glad to be reminded to revisit it :). On Sat, Apr 6, 2013 at 11:13 AM, Kim-Ee Yeoh k...@atamo.com wrote: On Sun, Apr 7, 2013 at 12:43 AM, Henning Thielemann lemm...@henning-thielemann.de wrote: Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the meaning of reference and transparency in a dictionary, but I don't know why these words were chosen as name for this defined property. Instead of a immaculately precise definition, may I suggest going about it from the practical benefits POV? RT matters so much in Haskell because of the engineering leverage it gives us. Bird's Pearls are a good source of Why Equational Reasoning Matters. -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.
On 13-04-05 04:56 AM, Tom Ellis wrote: any is very ambiguous. Doesn't the problem go away if you replace it with all? Yes, that is even better. The world would be simple and elegant if it did things your way, and would still be not too shabby if it did things my way, no? «Learn You a Haskell for Great Good!» by Miran Lipovača: http://learnyouahaskell.com/types-and-typeclasses#type-variables Because it's not in capital case it's actually a type variable. That means that a can be of any type. «The Haskell School of Expression» by Paul Hudak: page 57 Intuitively, what we'd like to say is that, for any type a, the type of length is [a] - Integer. So length can be applied to a list containing elements of any type. (Does [True, 'x'] count as a list containing elements of any type?) At this point, you may be rightful to accuse me of taking sentences out of context. I acknowledge it. The contexts have examples and other words on using this new freedom of any; hopefully, readers pick up the unsaid message: who has that freedom. It is correct to say: the accompanying examples and words make it sufficiently clear. The flip side is: look how many examples and words you have to set up to make it sufficiently clear. This thread began with the omission vs inclusion of syntax forall t or equivalent. It also, clearly, set the beginner classroom context. If someone replied, since it is a rank-1 language, the omission is syntactically simpler, the inclusion would be syntactically repetitive, I would agree. In fact I hold that opinion. But that has not been the reply. The reply has been, the omission is semantically simpler, and that's what I object to. All I see is evidence against it. Look how many examples and words you have to set up to teach it. Their length testifies the semantic complexity or complication. You have saved teaching syntax, but you haven't saved teaching semantics, semantics of something unrepresented by syntax. As for what mathematicians self-inflict on themselves, I should have, right at the beginning, just dismissed them and said: the context is beginner classroom, I don't care what happens between grad students and their thesis supervisors, it's their own business. If they just needed to wink-wink nudge-nudge and that finished transmitting a proof of P=NP, good for them. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?
Hi, I'm a hobbyist Haskell programmer and my use of Haskell is mostly consists of writing interpreters, simple virtual machines, and type checkers. One thing I'm not happy about my Haskell programs is, almost all of my programs have a monad transformer stack consisting MonadError, MonadIO and MonadState. Let's say I'm writing an interpreter, I certainly need MonadIO to interpret object language's IO functions: printing, reading from file etc. I also need MonadState for, well, states(dynamic environment etc.). MonadError is also required because most computations can fail(unbound variable error, type mismatch etc. it can be also used for implementing exceptions in object language) Same applies for my other applications as well. Type checkers require MonadError(unification error etc.), MonadState(to keep substitutions). MonadIO is not required in this case. But it also required for virtual machines(IOVector for memory -- ST vectors also work, but IO is still required for other stuff - printing, display etc.) I know these are mostly related with my application area, but I still wanted to write this because I may be missing something, or simply doing things wrong. Advices from experienced Haskell programmers would be appreciated, Cheers, Ömer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code-as-config, run-time checks and error locations
Good Point! Doesn't quite meet my requirements (I don't want to show the error loc somewhere deep within the libs), but it led me here[1]. Reading through that now... [1] http://hackage.haskell.org/trac/ghc/wiki/ExplicitCallStack On 04/06/2013 07:51 PM, Kim-Ee Yeoh wrote: On Sun, Apr 7, 2013 at 12:23 AM, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: For the moment I think it would be enough to auto-insert the location of calls to a certain set of functions. Have you tried assert [1]? [1] http://hackage.haskell.org/packages/archive/base/4.6.0.1/doc/html/Control-Exception.html#v:assert -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?
On Sun, Apr 7, 2013 at 4:22 AM, Ömer Sinan Ağacan omeraga...@gmail.com wrote: I'm a hobbyist Haskell programmer and my use of Haskell is mostly consists of writing interpreters, simple virtual machines, and type checkers. One thing I'm not happy about my Haskell programs is, almost all of my programs have a monad transformer stack consisting MonadError, MonadIO and MonadState. Welcome! Hobbyist Haskellers writing VMs and type checkers are a critical part of the community and what sets us apart. Not as well-known as it should be is the fact that GHC doesn't make much use of monad transformers. Have you taken a look at the sources? That might provide ideas on future ways of structuring your experiments. Also, what precisely are the infelicities with monad transformers in your code? Depth of stack? Forced type annotation? Syntax inflation due to extra lift* functions? Monad transformers provide an abstraction which may not be necessary for some apps. But it's easy to write something and then suddenly, the need for generalization kicks in. -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?
Hi Ömer, You forgot to mention what your problem is. :) What you describe sounds reasonable. Why do you want to escape? Roman * Ömer Sinan Ağacan omeraga...@gmail.com [2013-04-07 00:22:58+0300] Hi, I'm a hobbyist Haskell programmer and my use of Haskell is mostly consists of writing interpreters, simple virtual machines, and type checkers. One thing I'm not happy about my Haskell programs is, almost all of my programs have a monad transformer stack consisting MonadError, MonadIO and MonadState. Let's say I'm writing an interpreter, I certainly need MonadIO to interpret object language's IO functions: printing, reading from file etc. I also need MonadState for, well, states(dynamic environment etc.). MonadError is also required because most computations can fail(unbound variable error, type mismatch etc. it can be also used for implementing exceptions in object language) Same applies for my other applications as well. Type checkers require MonadError(unification error etc.), MonadState(to keep substitutions). MonadIO is not required in this case. But it also required for virtual machines(IOVector for memory -- ST vectors also work, but IO is still required for other stuff - printing, display etc.) I know these are mostly related with my application area, but I still wanted to write this because I may be missing something, or simply doing things wrong. Advices from experienced Haskell programmers would be appreciated, Cheers, Ömer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] code-as-config, run-time checks and error locations
On Sun, Apr 7, 2013 at 4:37 AM, Steffen Schuldenzucker sschuldenzuc...@uni-bonn.de wrote: Reading through that now... [1] http://hackage.haskell.org/trac/ghc/wiki/ExplicitCallStack If you're reading that page, you probably also want to get up to speed on the latest. The thread titled RFC: rewrite-with-location proposal just ended recently [1]. [1] http://www.haskell.org/pipermail/haskell-cafe/2013-February/106617.html -- Kim-Ee ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?
You forgot to mention what your problem is. :) What you describe sounds reasonable. Why do you want to escape? It's not really a problem, I'm not happy with this design because to me it was like I'm missing the point of using a 'functional' language. For instance, in most parts of my code I can actually do IO. On the other hand, I know it's mostly because of my application area and nothing to do with Haskell. Let's say I just wanted to know ideas of experienced Haskell programmers :-) Ömer --- Ömer Sinan Ağacan http://osa1.net/ 2013/4/7 Roman Cheplyaka r...@ro-che.info: Hi Ömer, You forgot to mention what your problem is. :) What you describe sounds reasonable. Why do you want to escape? Roman * Ömer Sinan Ağacan omeraga...@gmail.com [2013-04-07 00:22:58+0300] Hi, I'm a hobbyist Haskell programmer and my use of Haskell is mostly consists of writing interpreters, simple virtual machines, and type checkers. One thing I'm not happy about my Haskell programs is, almost all of my programs have a monad transformer stack consisting MonadError, MonadIO and MonadState. Let's say I'm writing an interpreter, I certainly need MonadIO to interpret object language's IO functions: printing, reading from file etc. I also need MonadState for, well, states(dynamic environment etc.). MonadError is also required because most computations can fail(unbound variable error, type mismatch etc. it can be also used for implementing exceptions in object language) Same applies for my other applications as well. Type checkers require MonadError(unification error etc.), MonadState(to keep substitutions). MonadIO is not required in this case. But it also required for virtual machines(IOVector for memory -- ST vectors also work, but IO is still required for other stuff - printing, display etc.) I know these are mostly related with my application area, but I still wanted to write this because I may be missing something, or simply doing things wrong. Advices from experienced Haskell programmers would be appreciated, Cheers, Ömer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?
Not as well-known as it should be is the fact that GHC doesn't make much use of monad transformers. Have you taken a look at the sources? That might provide ideas on future ways of structuring your experiments. That's interesting, thanks! Do you have any recommendations about which file to start reading? AFAIK, GHC is _huge_. Ömer ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?
Hi, Ömer Sinan Ağacan wrote: One thing I'm not happy about my Haskell programs is, almost all of my programs have a monad transformer stack consisting MonadError, MonadIO and MonadState. You can try to write most of your program in pure functions that are called from a few main functions in the monad. Or, if you need some but not all monadic actions in each function, you can use the following pattern: -- This helper function cannot cause monadic effects other than -- throwing errors. But it can be used in arbitrary monads that -- support throwing errors. helper :: MonadError MyError m = ... - m ... helper = do ... -- Same but with only allowing IO, but other monadic actions other :: MonadIO m = ... - m ... other = do ... -- we can use both functions in the same monad main = runMyStack $ do helper other This way, you have some control over what effects are allowed where. Tillmann ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] meaning of referential transparency
On 04/06/2013 08:43 PM, Henning Thielemann wrote: Can someone enlighten me about the origin of the term referential transparency? I can lookup the definition of referential transparency in the functional programming sense in the Haskell Wiki and I can lookup the meaning of reference and transparency in a dictionary, but I don't know why these words were chosen as name for this defined property. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe I will recommend you book Modern Compiler Design by Dick Grune and others. Besides discussing different topics, authors use Haskell as example for describing ideas behind compilers for functional language. Here is citation from book on RT, which not explain who coined this term, but describes it generally : By definition, a function in Haskell defines a fixed relation between inputs and out- put: whenever a function f is applied to the argument value arg it will produce the same output no matter what the overall state of the computation is. Haskell, like any other pure functional language, is said to be “referentially transparent” or “side- effect free.” This property does not hold for imperative languages, where assign- ments to global variables and through pointers may cause two function calls f arg to yield different results, even when the argument value arg is the same in both calls. The good thing about referential transparency is that it simplifies program anal- ysis and transformation since a closed expression always denotes the same value independent of the context, and may be moved around freely. A closed expression is an expression that contains no references to external names other than global iden- tifiers. -- Best regards, Sergey Bushnyak ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Haskell is a declarative language? Let's see how easy it is to declare types of things.
On Sat, Apr 06, 2013 at 05:14:48PM -0400, Albert Y. C. Lai wrote: On 13-04-05 04:56 AM, Tom Ellis wrote: any is very ambiguous. Doesn't the problem go away if you replace it with all? Yes, that is even better. The world would be simple and elegant if it did things your way, and would still be not too shabby if it did things my way, no? I'm not sure what your way is, but since you seem to be arguing for explicitness then I agree. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] Is there an escape from MonadState+MonadIO+MonadError monad stack?
On Sun, 7 Apr 2013 01:02:12 +0300 Ömer Sinan Ağacan omeraga...@gmail.com wrote: I'm not happy with this design because to me it was like I'm missing the point of using a 'functional' language. You kind of do, e.g. you might not be able to test parts of your program independently. For instance, in most parts of my code I can actually do IO. You can disable IO in parts of your code by making it polymorphic over monad. {-# LANGUAGE RankNTypes #-} type MonadStack = ErrorT Err (StateT St IO) type MonadStackNoIO = forall m. Monad m = ErrorT Err (StateT St m) ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
[Haskell-cafe] Compilers book in Haskell
Juan, te puede interesar On Sat, Apr 6, 2013 at 5:56 PM, Sergey Bushnyak sergey.bushn...@sigrlami.eu wrote: I will recommend you book Modern Compiler Design by Dick Grune and others. Besides discussing different topics, authors use Haskell as example for describing ideas behind compilers for functional language. -- Andrés ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: psqueue-benchmarks - benchmarks of priority queue implementations
On 30/03/13 06:44, Louis Wasserman wrote: That said, I'm not sure I follow how queuelike is a psqueue at all as opposed to a pqueue? Louis, you are actually right. I was tricked by the delete function, which takes only the queue, not the key, so it simply pops the top - queuelike is not a psqueue. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe
Re: [Haskell-cafe] ANN: psqueue-benchmarks - benchmarks of priority queue implementations
@Cale, do you have a repo of fingertree-psqueue around? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe