Re: [Haskell-cafe] Re: Explaining monads

2007-08-13 Thread Tillmann Rendel
David Roundy wrote: It's the *effect* of a monad, not the *side* effect. The type of = defines this dependency. And when you have a chain of dependencies, that is sometimes referred to as a sequence. True, it's not mystical, but it's still sequenced. How can a Haskell type define a data

Re: [Haskell-cafe] Re: [Off topic] Proving an impossibility

2007-09-04 Thread Tillmann Rendel
Vimal wrote: Ah, yes, it is possible in this case, but you have used an extra variable. It is okay, but our professor doesnt want to put emphasis on Computability here (or maybe I dont realize it), but the point is: Are such programming constructs really necessary in a programming language? i.e.

Re: [Haskell-cafe] newbie optimization question

2007-10-28 Thread Tillmann Rendel
= 0; for (int j = 1; j i; j++) if (i % j == 0) sum += i; if (sum == i) print(i); } Loops can be expressed with lazy lists in Haskell. Therefore, the presented Haskell program is perfectly equivalent to the obvious c program. Tillmann Rendel

Re: [Haskell-cafe] Searched for mdo on Found nothing.

2007-11-22 Thread Tillmann Rendel
Hi Andrew, Andrew Coppin wrote: In general, I find *most* search functions to be fairly unhelpful. Google is the shining exception to this rule; it almost always seems to figure out what you're after. I guess doing text searching is just a fundamentally difficult problem, and the guys at

Re: [Haskell-cafe] Why is this strict in its arguments?

2007-12-05 Thread Tillmann Rendel
Andrew Coppin wrote: *thinks* Conjecture #1: All nontrivial properties of a computer program are undecidable in general. That is the well-known Rice's theorem. (A very handy one in exams about theoretical computer science, since you can smash so many questions with follows from Rice).

Re: [Haskell-cafe] Hoogle works once more

2007-12-06 Thread Tillmann Rendel
Dougal Stanton wrote: Is there a way to search on module names? If I put in Data.Map then the one thing that doesn't come up is a link to the library page for Data.Map. That would be a really good short-cut. You can already search for unqualified module names:

Re: [Haskell-cafe] Software Tools in Haskell

2007-12-12 Thread Tillmann Rendel
Hi Tommy, detab is one of the programs I do not like. I kept the direct translation approach up through that, but I think it really hides the simplicity there; detab copies its input to its output replacing tabs with 1-8 spaces, based on where the tab occurs in a line. The only interesting

Re: [Haskell-cafe] OOP'er with (hopefully) trivial questions.....

2007-12-18 Thread Tillmann Rendel
Felipe Lessa wrote: class Shape a where whatever class (Shape a, Shape b) = Intersectable a b where intersect :: a - b - Bool This looks nice at first sight, but is it usefull in practice? I can somehow express the type any shape wich is intersectable with a given other shape,

Re: [Haskell-cafe] Multiple statements with Where

2007-12-18 Thread Tillmann Rendel
insertjokehere wrote: --A parser for recognising binary operations parseBinaryOp :: String - String - [(Expr, Expr, String)] parseBinaryOp op str | (elem op binops) (notElem '(' (snd bm)) (notElem ')' (snd bm)) (elem nstr!!1 binops) = [(EInt 1, EInt 1, HERE!)] You want (elem (nstr

Re: [Haskell-cafe] Knowledge

2007-12-20 Thread Tillmann Rendel
jlw501 wrote: I'm new to functional programming and Haskell and I love its expressive ability! I've been trying to formalize the following function for time. Given people and a piece of information, can all people know the same thing? Anyway, this is just a bit of fun... but can anyone help me

Re: [Haskell-cafe] Class/Instance : what am I doing wrong in this example ?

2007-12-20 Thread Tillmann Rendel
david48 wrote: class Gadget g where fInit :: g - a - g data FString = FString !Int !String deriving Show instance Gadget FString where at this point fInit has this type: FString - a - FString fInit (FString n _) s = FString n (take n s) but your implementation has this type

Re: [Haskell-cafe] instance Monad Either?

2007-12-20 Thread Tillmann Rendel
Eric wrote: According to this Either is an instance of class Monad, but when I try to use the do notation I get a compiler error. What's going on? Try to import Control.Monad.Error to get a Monad instance for

Re: [Haskell-cafe] Difference lists and ShowS (Was: The Worker/Wrapper Transformation)

2008-01-03 Thread Tillmann Rendel
Henning Thielemann wrote: Sometimes I believed that I understand this reason, but then again I do not understand. I see that left-associative (++) like in ((a0 ++ a1) ++ a2) ++ a3 would cause quadratic time. But (++) is right-associative and 'concat' is 'foldr'. They should not scan the

Re: [Haskell-cafe] Problem with own written monad

2008-01-07 Thread Tillmann Rendel
Michael Roth wrote: while trying to learn the secrets of monads, I decided to write a simply monand for pure educational purpose. But it turned out that it isn't as easy as I thought... I circumnavigate quite a number of hurdles but now I reached a point where I'm at a loss. :-( data

Re: [Haskell-cafe] Type Mismatch

2008-01-07 Thread Tillmann Rendel
Cetin Sert wrote: class Streamable a where to :: a - Stream a The type of to looks wrong for me. a - Stream a means to takes a single element into a stream of such elements, but you probably want to convert between different representations of streams of elements. toStream :: [a] -

Re: [Haskell-cafe] Trouble with function with two clauses

2008-01-09 Thread Tillmann Rendel
Fernando Rodriguez wrote: data ConsCell a = Nil | Cons a (ConsCell a) deriving Show head' Nil = Nothing head' (Cons a _) = Just a Works fine, however, what's wrong with the following function? head'' | Nil = Nothing | Cons a _ = Just a You cannot use | as a general shortcut in

Re: [Haskell-cafe] confusion about 'instance'....

2008-01-10 Thread Tillmann Rendel
Nicholls, Mark wrote: I only have 1 type. If I say my name is mark twice, it doesn't mean I belong to set of objects called Mark twice Typeclasses define not only sets of types, but a common interface for these types, too. An analogy would be to say: I have a name, and it is Marc.

Re: [Haskell-cafe] Re: Why purely in haskell?

2008-01-10 Thread Tillmann Rendel
[EMAIL PROTECTED] wrote: Although it could be argued that laziness is the cause of some very obscure bugs... g Niko Example, PLEASE. Prelude sum [1..100] *** Exception: stack overflow Prelude Data.List.foldl' (+) 0 [1..100] 5050 Tillmann

Re: [Haskell-cafe] Re: Why purely in haskell?

2008-01-10 Thread Tillmann Rendel
Achim Schneider wrote: [1..] == [1..] [some discussion about the nontermination of this expression] The essence of laziness is to do the least work necessary to cause the desired effect, which is to see that the set of natural numbers equals the set of natural numbers, which, axiomatically,

Re: [Haskell-cafe] more thoughts on Finally tagless

2010-03-09 Thread Tillmann Rendel
Tom Schrijvers wrote: Yeah, subject Finally Tagless again, sorry, I'm just not done with it yet. In Olegs haskell implementation he is using classes mainly to model the syntax and instances to use for evaluators / compilers to allow multiple interpretations. I wonder if it'd be possible to do

Re: [Haskell-cafe] more thoughts on Finally tagless

2010-03-10 Thread Tillmann Rendel
Martijn van Steenbergen wrote: Tom Schrijvers wrote: data EvalDict sem = EvalDict { val :: Int - sem Int, add :: sem Int - sem Int - sem Int } An alternative option is to capture the structure in a GADT: data Eval a where Val :: Int - Eval Int Add :: Eval Int - Eval Int - Eval Int And

Re: [Haskell-cafe] First time haskell - parse error!

2010-03-10 Thread Tillmann Rendel
Ketil Malde wrote: Also, good names are harder than they sound: I don't think 'belowLimit' is a good name for 'takeWhile (1)', for instance. I certainly couldn't guess what it was for without looking at the implementation, which kind of defeats the purpose of names for improving code

Re: [Haskell-cafe] more thoughts on Finally tagless

2010-03-10 Thread Tillmann Rendel
Tom Schrijvers wrote: William Cook's Onward! essay is relevant here. He characterizes the difference between objects and abstract data types nicely: the latter allow binary methods that pattern match (to exploit the combined knowledge of the internals of two different values) whereas objects

Re: [Haskell-cafe] Abstraction in data types

2010-03-18 Thread Tillmann Rendel
Darrin Chandler wrote: data Point = Cartesian (Cartesian_coord, Cartesian_coord) | Spherical (Latitude, Longitude) type Center = Point type Radius = Float data Shape = Circle Center Radius | Polygon [Point] This obviously stinks since a Polygon could

Re: [Haskell-cafe] searching a function by providing examples of input/ouput pairs

2010-03-18 Thread Tillmann Rendel
Paul Brauner wrote: feature [...] to search function in the library by giving a list of pairs of inputs/ouputs. [...] But, piggibacking such a feature on top of hoogle would surely be more efficient: 1. infer types for arguments and outout 2. look for matching functions using google 3.

Re: [Haskell-cafe] Sugar for function application

2010-03-24 Thread Tillmann Rendel
Brandon S. Allbery KF8NH wrote: On Mar 23, 2010, at 13:39 , Ertugrul Soeylemez wrote: layout-style syntactic sugar for function application. Here is an example of what it might look like: function $$ anArgument sin (x^2) anotherArgument f $ x + 3

Re: [Haskell-cafe] GHC vs GCC

2010-03-27 Thread Tillmann Rendel
Jan-Willem Maessen wrote: It's worth pointing out that there's a bit of bang-pattern mysticism going on in this conversation (which has not been uncommon of late!). A non-buggy strictness analyzer should expose the strictness of these functions without difficulty. Could the result of

Re: [Haskell-cafe] Re: building encoding on Windows?

2010-03-30 Thread Tillmann Rendel
Ivan Miljenovic wrote: The Haskell Platform is supposed to be a development environment... No-one ever said it was a _complete_ development environment and that you'd never need any other libraries, tools, etc. On, someone wrote: The Haskell

Re: [Haskell-cafe] Simple game: a monad for each player

2010-04-13 Thread Tillmann Rendel
Yves Parès wrote: data Player m = Player { plName :: String, -- unique for each player plTurn :: GameGrid - m Move -- called whenever the player must play } What I try to avoid is having every player running in IO monad. One could define the following players. human :: MonadIO

Re: [Haskell-cafe] Function to find a substring

2010-06-08 Thread Tillmann Rendel
Hi, R J wrote: What's an elegant definition of a Haskell function that takes two strings and returns Nothing in case the first string isn't a substring of the first, or Just i, where i is the index number of the position within the first string where the second string begins? The naive

[Haskell-cafe] The Arrow class (was: Vague: Assembly line process)

2010-06-16 Thread Tillmann Rendel
Bas van Dijk wrote: data Iso (⇝) a b = Iso { ab ∷ a ⇝ b , ba ∷ b ⇝ a } type IsoFunc = Iso (→) instance Category (⇝) ⇒ Category (Iso (⇝)) where id = Iso id id Iso bc cb . Iso ab ba = Iso (bc . ab) (ba . cb) An 'Iso (⇝)' also _almost_ forms an

Re: [Haskell-cafe] Mapping a list of functions

2010-06-17 Thread Tillmann Rendel
Martin Drautzburg wrote: The standard map function applies a single function to a list of arguments. But what if I want to apply a list of functions to a single argument. So your list of arguments is actually a list of functions. But since functions are first-class values, that shouldn't be

Re: Réf. : Re: [Haskell-cafe] GHCi and State

2010-06-25 Thread Tillmann Rendel
Hi Corentin, schrieb: for GHCi, i will try an IORef. Too bad i allready coded it using StateT GameState IO () extensively through the code ;) That shouldn't be a problem, you could switch back and forth in submitRule, approximately like this: startGame :: IO

Re: [Haskell-cafe] Huffman Codes in Haskell

2010-06-26 Thread Tillmann Rendel
John Lato wrote: How would you implement bfnum? (If you've already read the paper, what was your first answer?) My first idea was something similar to what is described in appendix A. However, after reading the paper, I wrote the following code: data Tree a = E | T a (Tree a) (Tree a)

Re: [Haskell-cafe] zlib or digest package installation

2010-06-30 Thread Tillmann Rendel
Hi Daniel, Daniel Kahlenberg wrote: when installing pandoc package, which has digest somewhere in dependencies the usual cabal install stucks because zlib.h is missing [...] I had a similar or the same problem with digest and zlib.h two months ago, which I reported to the Haskell platform

Re: [Haskell-cafe] Criteria for determining if a recursive function can be implemented in constant memory

2010-07-05 Thread Tillmann Rendel
Hi Steffen, Steffen Schuldenzucker wrote: since a little discussion with my tutor I am wondering how the following problem can be solved and if it is decidable: Given the definition of a recursive function f in, say, haskell, determine if f can be implemented in O(1) memory. Constant

Re: [Haskell-cafe] Subtype polymorphism in Haskell

2010-07-05 Thread Tillmann Rendel
Simon Courtenage wrote: I am porting a C++ program to Haskell. My current task is to take a class hierarchy and produce something equivalent in Haskell, but I don't seem to be able to get a grip on how type classes and instances contribute to the solution. They probably do not contribute

Re: [Haskell-cafe] use of modules to save typing

2010-07-08 Thread Tillmann Rendel
Michael Mossey wrote: incrCursor :: State PlayState () Additional question: what is proper terminology here? Proper terminology for monadic things is somewhat debated. incrCursor is a monad This is not true. incrCursor is a monadic type incrCursor is not a type, so this can't be

Re: [Haskell-cafe] Re: lhs2TeX - lhs2TeX.fmt missing

2010-07-11 Thread Tillmann Rendel
Hi Ivan, (why are you answering off-list?) Ivan Miljenovic wrote: I was under the impression that with cweb, you can have one function definition split into two, with another completely different block of code in between them. I agree, that's something literate haskell can not do. (But it's

Re: [Haskell-cafe] Can we come out of a monad?

2010-07-30 Thread Tillmann Rendel
C K Kashyap wrote: I am of the understanding that once you into a monad, you cant get out of it? That's not correct. There are many monads, including Maybe, [], IO, ... All of these monads provide operations (=), return and fail, and do notation implemented in terms of these functions, as

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-07-30 Thread Tillmann Rendel
Hi, I wrote: There is nothing special about monads! Kevin Jardine wrote: I've seen plenty of comments suggesting that monads are easy to understand, but for me they are not. My point was that monads are not a language feature whith special treatment of the compiler, but more like a design

Re: [Haskell-cafe] Laziness question

2010-07-31 Thread Tillmann Rendel
michael rice wrote: f x = length [head x] g x = length (tail x) Wouldn't both functions need to evaluate x to the same level, *thunk* : *thunk* to insure listhood? There is no need to insure listhood at run time, since Haskell is statically typed. Tillmann

Re: [Haskell-cafe] Suggestions For An Intro To Monads Talk.

2010-08-04 Thread Tillmann Rendel
Hi, aditya siram wrote: For example in the beginning it was useful for me to think of monads (and typeclasses really) as approximating Java interfaces. Type classes are somewhat parallel to Java interfaces, but Monad is a *specific* type class, so it should be somewhat parallel to a

Re: [Haskell-cafe] can Haskell do everyting as we want?

2010-08-04 Thread Tillmann Rendel
Ivan Lazar Miljenovic wrote:: My understanding of tab-completion in IDEs for Java, etc. is that it just displayed every single possible class method for a particular object value, and then did some kind of matching based upon what you typed to narrow down the list, not that it was type-based.

Re: [Haskell-cafe] background question about IO monad

2008-02-06 Thread Tillmann Rendel
Uwe Hollerbach wrote: lispUTCTime [] = doIOAction (getClockTime) toS allErrs where toS val = String (calendarTimeToString (toUTCTime val)) here you use liftIO (hidden in doIOAction) to use an IO action (getClockTime) inside of a different monad wich contains IO at it's base. so your custom

Re: [Haskell-cafe] Inverting a Monad

2008-02-06 Thread Tillmann Rendel
Bas van Dijk wrote: The following obviously doesn't work: import Control.Monad.Error inv :: MonadError e m = m a - m () inv m = (m fail ) `catchError` \_ - (return ()) What about this? inv :: MonadError e m = m a - m () inv m = join $ (m return mzero) `catchError` \_ - return (return ())

Re: [Haskell-cafe] Create a list without duplicates from a list with duplicates

2008-02-08 Thread Tillmann Rendel
Dan Weston wrote: Meanwhile, here is a hand-rolled solution to order-preserving nubbing: import Data.List(groupBy,sortBy,sort) import Data.Maybe(listToMaybe) efficientNub :: (Ord a) = [a] - [a] efficientNub = flip zip [0..]-- carry along index sort

Re: [Haskell-cafe] Type system

2008-03-14 Thread Tillmann Rendel
Hi Andrew, Andrew Coppin wrote: Haskell has an expressive and powerful type system - which I love. It also has a seemingly endless list of weird and obscure type system extensions. And there are various things you can do in Haskell which *require* some pretty serious type system hackery.

Re: [Haskell-cafe] Converting image2PS function

2008-03-18 Thread Tillmann Rendel
iliali16 wrote: I have this function ready image2PS:: Image - String - IO() but when I use it for example image2PS spiral iliali it tells me that the iliali is undefined. iliali is a variable, which has to be bound so it can be used, e.g. iliali = iliali main = image2PS spiral

Re: [Haskell-cafe] How to implement Read instance for user defined type

2008-03-20 Thread Tillmann Rendel
Verma Anurag wrote: module Mark where data Mark = Mark Int deriving (Show) instance Read Mark where readsPrec _ str = [(Mark x, t') | (mark,t) - reads str, (x,t') - reads t The problem with this instance is that reads expect Strings to be enclosed in

Re: [Haskell-cafe] An ugly zip3 problem..

2008-03-20 Thread Tillmann Rendel
Michael Feathers wrote: I'm working on something and it's looking rather ugly. essentially, it's an application of a low pass filer to a dataset. I would not consider your code ugly. it can be made shorter, though. type Dataset = [Double] type FilterWindow3 = (Double,Double,Double)

Re: [Haskell-cafe] Parsec Expected Type

2008-03-30 Thread Tillmann Rendel
Paul Keir wrote: What I'd like is to parse either the string parameter, or the string :. I'm using 'reserved' and 'symbol' because they seem to correspond well to the concepts in the language I'm parsing. You may consider using reservedOp for :, depending on how :+ should be parsed:

Re: [Haskell-cafe] How can I represent 4x4 map in haskell

2008-03-31 Thread Tillmann Rendel
iliali16 wrote: type Line = [Char] type Board = [Line] so my question is if this is ok to represent a map. If yes I will try to write the function which makes it 4 x 4 myself. What I jsut need as an answer is Yes or No. Just to let you know is that I am trying to build the Wumpus World A

Re: [Haskell-cafe] Fighting the monad stack, MonadIO

2008-04-10 Thread Tillmann Rendel
Adam Smyczek wrote: For a small webapi binding I try to implement a session like monad by building a stack including BrowserAction from Network.Browser module as following: newtype RBAction a = RBAction { exec :: ErrorT String (StateT RBState BrowserAction) a } deriving (Functor, Monad,

[Haskell-cafe] Re: Embedding newlines into a string?

2008-04-14 Thread Tillmann Rendel
Benjamin L. Russell wrote: but got stuck on outputting newlines as part of the string; quoting is done by the show function in Haskell, so you have to take care to avoid calling show. your code calls show at two positions: (1) when you insert the newline into the string (2) when you output

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-14 Thread Tillmann Rendel
Benjamin L. Russell wrote: Ok; much better. Here's my new type signature and definition: hanoi :: Int - IO () hanoi_helper :: Char - Char - Char - Int - [String] If you want, you can separate the algorithm and the output processing even more by providing three functions of these types:

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-14 Thread Tillmann Rendel
Neil Mitchell wrote: Unlines puts a trailing new line at the end of every line, including the final one. putStrLn puts an additional trailing new line, so you get 2 at the end. Thanks for that clarification. mapM_ putStrLn == putStr . unlines I'm wondering which (==) you mean here ;)

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-14 Thread Tillmann Rendel
Benjamin L. Russell wrote: Wow, that's very general. So you want to divide hanoi into a main function, a helper function, and a display function. I tried it out, and got this far so far: [...] hanoi_shower :: Show a = [(a, a)] - String hanoi_shower [(a, b)] = Move ++ show a ++ to ++

Re: [Haskell-cafe] Re: Embedding newlines into a string?

2008-04-15 Thread Tillmann Rendel
Benjamin L. Russel wrote: hanoi_shower ((a, b) : moves) | null moves = ... | otherwise == ... Luke Palmer wrote: More idiomatic pedantry: the way you will see most Haskellers write this style of function is by pattern matching rather than guards: hanoi_shower [] = ... hanoi_shower

Re: [Haskell-cafe] Re: Aren't type system extensions fun? [Further analysis]

2008-05-27 Thread Tillmann Rendel
Andrew Coppin wrote: So, after an entire day of boggling my mind over this, I have brought it down to one simple example: (id 'J', id True) -- Works perfectly. \f - (f 'J', f True) -- Fails miserably. Both expressions are obviously perfectly type-safe, and yet the type checker

Re: [Haskell-cafe] appending an element to a list

2008-05-29 Thread Tillmann Rendel
Adrian Neumann wrote: Hello, I was wondering how expensive appending something to a list really is. Say I write I'd say longList ++ [5] stays unevaluated until I consumed the whole list and then appending should go in O(1). Similarly when concatenating two lists. Is that true, or am I

Re: [Haskell-cafe] appending an element to a list

2008-05-30 Thread Tillmann Rendel
Lanny Ripple wrote: My $0.02 is to say -- O(1) longList ++ [5] Yay. I've got a thunk. Oh wait, I need to access the '5'? No different than doing so for -- O(n) until ((==5) . head) [l,o,n,g,L,i,s,t,5] It's not the (++) that's O(n). It's the list traversal. Lets look at the actual

Re: [Haskell-cafe] Re: appending an element to a list

2008-05-31 Thread Tillmann Rendel
Abhay Parvate wrote: I think I would like to make another note: when we talk about the complexity of a function, we are talking about the time taken to completely evaluate the result. Otherwise any expression in haskell will be O(1), since it just creates a thunk. I don't like this notion of

Re: [Haskell-cafe] Architecturally flawed

2008-07-14 Thread Tillmann Rendel
Andrew Coppin wrote: [design of a bitwise binary library] (This would all be so trivial in an OO language. Just make an Encoder object that updates its own state internally and talks to a Source object and a Destination object for its data...) I guess it's on the same level of trivialness

Re: [Haskell-cafe] Trying to install cabal

2008-07-14 Thread Tillmann Rendel
Brandon S. Allbery KF8NH wrote: I have downloaded cabal and am trying to install it but have gotten the following error message: C:\cabal\cabal-install-0.5.1runghc Setup configure Cabal itself is a special case; you need the same version of Cabal already installed to install it via Cabal...

Re: [Haskell-cafe] Re: Data.Ring -- Pre-announce

2010-01-01 Thread Tillmann Rendel
Hi, Iavor Diatchki schrieb: I usually refer to this structure as a RingBuffer. Really? According to my understanding, and to wikipedia [1], a ring buffer is a data structure used to implement O(1) bounded FIFO queues with mutable arrays. So in a ring buffer, you have distinct reading and

Re: [Haskell-cafe] Couple of questions about *let* within *do*

2010-08-10 Thread Tillmann Rendel
michael rice wrote: OK, then there's also an implicit *in* after the *let* in this code. If you want to understand let statements in terms of let ... in ... expressions, you can do the following transformation: do s1 s2 let x1 = e1 x2 = e2 s3 s4 becomes do

Re: [Haskell-cafe] Accepting and returning polyvariadic functions

2010-08-11 Thread Tillmann Rendel
Will Jones wrote: f :: Int - IO () f = undefined g :: Int - Int - IO () g = undefined h :: Int - Int - Int - IO () h = undefined vtuple f :: IO (Int - (Int, ())) vtuple g :: IO (Int - Int - (Int, (Int, ( I've tried to type vtuple using a type class; [...] I've thought about

Re: [Haskell-cafe] Re: Can we come out of a monad?

2010-08-11 Thread Tillmann Rendel
Dan Doel wrote: But, to get back to BASIC, or C, if the language you're extending is an empty language that does nothing, then remaining pure to it isn't interesting. I can't actually write significant portions of my program in such a language, so all I'm left with is the DSL, which doesn't

Re: [Haskell-cafe] universal quantification is to type instantiations as existential quantification is to what

2010-08-12 Thread Tillmann Rendel
Hi, to understand forall and exists in types, I find it helpful to look at the terms which have such types. Joshua Ball wrote: mapInt :: forall a. (Int - a) - [Int] - [a] I can instantiate that function over a type and get a beta-reduced version of the type mapInt [String] :: (Int -

Re: [Haskell-cafe] Re: A GHC error message puzzle

2010-08-12 Thread Tillmann Rendel
Hi, the reading is not needed to make it happen. main = writeFile output blackhole where blackhole = blackhole In fact, writing is not needed either. main = bracket (openFile output WriteMode) hClose (\hdl - blackhole `seq` return ()) blackhole = blackhole Note that

Re: [Haskell-cafe] Re: A GHC error message puzzle

2010-08-13 Thread Tillmann Rendel
Simon Marlow wrote: So what happens is this: - the recursive definition causes the main thread to block on itself (known as a black hole) - the program is deadlocked (no threads to run), so the runtime invokes the GC to see if any threads are unreachable - the GC finds that (a)

Re: [Haskell-cafe] Re: A GHC error message puzzle

2010-08-14 Thread Tillmann Rendel
Simon Marlow wrote: Really hClose shouldn't complain about a finalized handle, I'll see if I can fix that. That sounds like a work-around to me, not a fix, because it would not fix more complicated exception handlers. I don't think there's a problem with more complicated exception handlers.

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Tillmann Rendel
Ertugrul Soeylemez wrote: let (x, world1) = getLine world0 world2 = print (x+1) world1 If between 'getLine' and 'print' something was done by a concurrent thread, then that change to the world is captured by 'print'. But in a world passing interpretation of IO, print is supposed to be

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Tillmann Rendel
Bulat Ziganshin wrote: But in a world passing interpretation of IO, print is supposed to be a pure Haskell function. So the value world2 can only depend on the values of print and world1, but not on the actions of some concurrent thread. the whole World includes any concurrent thread though ;)

Re: [Haskell-cafe] Re: philosophy of Haskell

2010-08-15 Thread Tillmann Rendel
Brandon S Allbery KF8NH wrote: I am confused by this discussion. I originally thought some time back that IO was about world passing, but in fact it's just handing off a baton to insure that a particular sequence of IO functions is executed in the specified sequence and not reordered. Nothing

Re: [Haskell-cafe] Unix emulation

2010-08-22 Thread Tillmann Rendel
Felipe Lessa wrote: I take it that the problem is that libcurl is a C library with a Unix-like build system, and that is the problem that needs Cygwin, right? One needs a compiler and libraries on the one hand, and a bunch of command-line tools on the other hand. On Windows, MinGW provides

Re: [Haskell-cafe] On to applicative

2010-09-01 Thread Tillmann Rendel
michael rice wrote: Prelude Data.Either let m = Just 7 Prelude Data.Either :t m m :: Maybe Integer So to create a value of type (Maybe ...), you can use Just. Prelude Data.Either let l = 2:[] Prelude Data.Either :t l l :: [Integer] So to create a value of type [...], you can use (:) and

Re: [Haskell-cafe] A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-12 Thread Tillmann Rendel
Hi Paolo, Paolo Giarrusso wrote: - when recompiling a package with ABI changes, does cabal always update dependent packages? It never recompiles them. Recompilation should not be needed, because different versions of packages exports different symbols, so a package can never be linked

Re: [Haskell-cafe] A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-12 Thread Tillmann Rendel
Hi Paolo, Paolo Giarrusso wrote: $ cabal install --dry cabal-install leksah- [... does not work ...] However, trying to install cabal-install and leksah separately works quite well. So do install them separately. cabal install p1 p2 is supposed to find a single consistent install

Re: [Haskell-cafe] A new cabal odissey: cabal-1.8 breaking its own neck by updating its dependencies

2010-09-12 Thread Tillmann Rendel
Hi Paolo, Paolo Giarrusso wrote: cabal install p1 p2 is supposed to find a single consistent install plan for p1 and p2 and the transitive dependencies of either of them. This is useful if you plan to use p1 and p2 in a single project. Ahah! Then it's a feature. The need for consistency stems

Re: [Haskell-cafe] type class design

2010-10-29 Thread Tillmann Rendel
Hi, Uwe Schmidt wrote: In the standard Haskell classes we can find both cases, even within a single class. Eq with (==) as f and (/=) as g belongs to the 1. case Note that the case of (==) and (/=) is slightly different, because not only can (/=) be defined in terms (==), but also the other

Re: [Haskell-cafe] Red links in the new haskell theme

2010-10-30 Thread Tillmann Rendel
Henning Thielemann wrote: If I enable JavaScript in Konqueror, I still see no style menu. However I would like to get it without JavaScript. It can certainly be achieved using a cookie. Both stylesheets are linked to from the text of the HTML files: link href=ocean.css rel=stylesheet

Re: [Haskell-cafe] Red links in the new haskell theme

2010-10-30 Thread Tillmann Rendel
Henning Thielemann wrote: Firefox uses this information to populate a menu (View | Stylesheet) with the following choices: - no style - Ocean - Classic No need for JavaScript or cookies. This would be optimal for me, if it would work this way. From the answers I understood that the style

Re: [Haskell-cafe] Edit Hackage

2010-10-31 Thread Tillmann Rendel
Ketil Malde wrote: Most web-based email archives seem to suck - where can we point to a nice URL to get an overview of a -cafe thread? Tillmann ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Haskell is a scripting language inspired by Python.

2010-11-05 Thread Tillmann Rendel
Hi, Albert Y. C. Lai wrote: I also invite you to play with my: Tillmann ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Rigid types fun

2010-11-05 Thread Tillmann Rendel
Hi, Mitar wrote: I would like to do that to remove repeating code like: from- newChan for- newChan let nerve = Nerve (Axon from) (AxonAny for) which I have to write again and again just to make types work out. Why I cannot move that into the function? One option is to write a little library

Re: [Haskell-cafe] Most popular haskell applications

2010-11-06 Thread Tillmann Rendel
Ivan Lazar Miljenovic wrote: Bulat Ziganshin wrote: people, are you know haskell apps that has more than 50k downloads per month (or more than 25k users) ? Possible candidates: * GHC * XMonad * Darcs * Pandoc I have no idea how to measure number of downloads or users, but pandoc is

Re: [Haskell-cafe] Serialization of (a - b) and IO a

2010-11-13 Thread Tillmann Rendel
Andrew Coppin wrote: [...] if you could send a block of code from one PC to another to execute it remotely. Eden can do this. Eden is a distributed Haskell: You run multiple copies of the same binary on different machines, and you have the (#)

Re: [Haskell-cafe] Re: ANNOUNCE zeno 0.1.0

2010-11-13 Thread Tillmann Rendel
Will Sonnex wrote: Zeno is a fully automated inductive theorem proving tool for Haskell programs. I tried it via the web interface, and it seems to be quite cool. Good work! However: You can express a property such as takeWhile p xs ++ dropWhile p xs === xs and it will prove it to be true

[Haskell-cafe] Re: [Haskell] intent-typing

2010-11-16 Thread Tillmann Rendel
Hi, Marcus Sundman wrote: Hi, how would one go about implementing (or using if it's supported out-of-the-box) intent-typing* for haskell? A basic technique is to use newtype declarations to declare separate types for separate intents. module StringSafety ( SafeString ()

Re: [Haskell-cafe] Reply-To: Header in Mailinglists

2010-11-19 Thread Tillmann Rendel
Hi Bastian, Bastian Erdnüß wrote: It would make my life a little bit more easy if the mailing lists on would add a Reply-To: header automatically to each message containing the address of the mailing list, the message was sent to. Usually that's the place where others would want to

Re: [Haskell-cafe] Musings on type systems

2010-11-20 Thread Tillmann Rendel
Hi Andrew, Andrew Coppin wrote: Now, what about type variables? What do they do? Well now, that seems to be slightly interesting, since a type variable holds an entire type (whereas normal program variables just hold a single value), and each occurrance of the same variable is statically

Re: [Haskell-cafe] Musings on type systems

2010-11-20 Thread Tillmann Rendel
Ketil Malde wrote: data Sum a b = A a | B b -- values = values in a + values in b data Prod a b = P a b-- values = values in a * values in b I guess this makes [X] an exponential type, although I don't remember seeing that term :-) I would expect the exponential type to be (a - b):

Re: [Haskell-cafe] Re: Re: Reply-To: Header in Mailinglists

2010-11-23 Thread Tillmann Rendel
Hi, Nick Bowler wrote: There is another header, Mail-Followup-To, which tells MUAs to also drop the To and CC lists. Interesting. So is it a good idea to use Mail-Followup-To to move a discussion from one list to another? To: CC:

Re: [Haskell-cafe] [Haskell] Functor = Applicative = Monad

2010-12-14 Thread Tillmann Rendel
Hi, John Smith wrote: I would like to formally propose that Monad become a subclass of Applicative A lot of code would break because of this change, but all problems should be reported at compile time, and are easy to fix. In most of the cases, either adding obvious Functor and Applicative

Re: [Haskell-cafe] [Haskell] Functor = Applicative = Monad

2010-12-15 Thread Tillmann Rendel
Hi John, John Smith wrote: Perhaps pattern match failures in a MonadPlus should bind to mzero - I believe that this is what your example and similar wish to achieve. You updated the proposal to say: a failed pattern match should error in the same way as is does for pure code, while in

Re: [Haskell-cafe] [Haskell] Functor = Applicative = Monad

2010-12-15 Thread Tillmann Rendel
John Smith proposed: a failed pattern match should error in the same way as is does for pure code, while in MonadPlus, the current behaviour could be maintained with mzero Lennart Augustsson wrote: Any refutable pattern match in do would force MonadFail (or MonadPlus if you prefer). I guess

Re: [Haskell-cafe] Template Haskell a Permanent solution?

2010-12-28 Thread Tillmann Rendel
Hi, Jonathan Geddes wrote: For TH use #1, compile-time parsing of arbitrary strings, I think it would be nice for quasiquote semantics to be modified so that code like json :: String - JsonObject json = ... data = [ json | { name : Jonathan , favorite language: Haskell } |]

Re: [Haskell-cafe] Reader monad

2010-12-29 Thread Tillmann Rendel
Hi, Michael Rice wrote: I think of (r - m a) as a type signature and Int or Bool by themselves as types. So, all type signatures are themselves types? Yes. In Haskell, functions are first class, so function types like (r - m a) are themselves types. Tillmann

  1   2   3   >