Re[2]: [Haskell-cafe] Why monad tutorials don't work

2007-08-14 Thread Miguel Mitrofanov
Grrr...must...hold...my...tongue... Dan, as a former student of a clone of that physics teacher, I am really interested in what you will say when you fail to hold your tongue. -- Bill Wood MV I have to admit I was wondering the same thing myself. So was I.

Re: [Haskell-cafe] Speed of character reading in Haskell

2007-09-07 Thread Miguel Mitrofanov
I started with the obvious main = getContents = print . tokenise where tokenise maps its way down a list of characters. This is very simple, very pleasant, and worked like a charm. However, the language has an INCLUDE directive, so I'm going to have to call readFile or something in

Re: [Haskell-cafe] Re: Tiny documentation request

2007-09-11 Thread Miguel Mitrofanov
When the index is generated with a more recent Haddock, you get a search field, which does an incremental search, so this might perhaps be more what you are looking for. A more aesthetical note: We should really get rid of the ugly table/CSS layout mixture, the lower part of the page renders

Re: [Haskell-cafe] Missing Symbol (2)

2007-09-19 Thread Miguel Mitrofanov
YAHT is available from wikibooks in HTML form. 19.09.2007, в 18:30, Joel Koerwer писал(а): Hi Paul, Sorry that my suggestion wasn't so practicable. On the other hand, I see that the YAHT tex source is available on darcs.haskell.org/yaht. Maybe we can do something about those unextractable

Re: [Haskell-cafe] Why isn't pattern matching lazy by default?

2007-09-19 Thread Miguel Mitrofanov
Now why isn't pattern matching lazy by default? This seems odd for a newbie since everything else is lazy by default. It's even more confusing that pattern matching in 'let' _is_ lazy. No, it's not. See, in let or where constructs you don't have a choice; you can't do different things

Re: [Haskell-cafe] reverse with foldl

2007-09-21 Thread Miguel Mitrofanov
reverse = foldl (\x - \xs - xs:x) [] Doesn't typecheck. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Shouldnt this be lazy too?

2007-09-24 Thread Miguel Mitrofanov
length [1..] 10 isnt lazily evaluated! I wouldnt expect this to be a bug, but in this case, shouldnt the computation end when the length function evaluation goes something like: No. You want GHC to deduce that length would only increase in future. This property is relatively complex and

Re: [Haskell-cafe] Complexity question

2007-09-24 Thread Miguel Mitrofanov
Because transpose is quite lazy, it need not necessarily result in a quadratic time complexity on every use. On the other hand, my program needs the entire transposed list, so... ;-) May be, you should consider some other data structures, for example (borrowed from fido7.ru.math): data

Re: [Haskell-cafe] Very crazy

2007-09-25 Thread Miguel Mitrofanov
How can one function have more than one type signature? It's called polymorphism. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: PROPOSAL: New efficient Unicode string library.

2007-10-02 Thread Miguel Mitrofanov
I would like to, again, strongly argue against sacrificing compatibility with Linux/BSD/etc. for the sake of compatibility with OS X or Windows. Ehm? I've used to think MacOS is a sort of BSD... ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] More accessible papers

2007-11-21 Thread Miguel Mitrofanov
Building a .tex file can be rather hard with packages and what-not, plus quite a few of us use lhst2tex as a preprocessor. It's not impossible, but its not trivial either, and I can't imagine that anyone would use a .tex over a PDF. I would prefer the .tex version any day! Why not have both

[Haskell-cafe] GUI

2007-12-12 Thread Miguel Mitrofanov
Is there any really cross-platform GUI library for Haskell? Gtk2Hs is good (I suppose), but it requires X. OK, I have X, but it's not native on my Mac; some Mac users don't install it and almost all Mac users don't always run it. I was able to install wxHaskell (after some hacking - this

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

2007-12-17 Thread Miguel Mitrofanov
There's a third way, too, and I haven't seen anybody mention it yet I've noticed it, but there are some problems with this representation, so I decided not to mention it. It's OK as far as we don't want functions working on two areas - I don't see, how we can implement, say, intersect ::

Re: [Haskell-cafe] New to Haskell

2007-12-18 Thread Miguel Mitrofanov
What I should have been told about upfront: - the syntax for an expression - the syntax for a block Don't see your point. - the adhoc syntax rules (how to distinguish among a tuple and a pharanthesized expression and how to find the start and end of a block for example ) Oh, that's

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

2007-12-18 Thread Miguel Mitrofanov
class Shape a where { intersect :: Shape b = a - b - Bool } data Shape a = { intersect :: Shape b = a - b - Bool } in fact, the syntax is rather similar, too! :) Um, well, and how are you going to implement it? ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] New to Haskell

2007-12-18 Thread Miguel Mitrofanov
- the syntax for an expression - the syntax for a block Don't see your point. The point is the syntax is introduced as transformation of layout form to non layout form. As a user, I just want to be able to spot the basic components of a source file without thinking about

Re: [Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Miguel Mitrofanov
- the lambda expressions can be written (input) but cannot be printed (output) This is a fundamental property of the language. A lambda expression is programme and at runtime the system doesn't know one lambda expression from another (all it can do with one is apply it to something).

Re: [Haskell-cafe] New to Haskell

2007-12-18 Thread Miguel Mitrofanov
As a user, I just want to be able to spot the basic components of a source file without thinking about transformation rules. Well, most users are. Are what ? Sorry if I've confused you. English isn't my native language. Are able, of course. Have you asked them all ? If you're

Re: [Haskell-cafe] Re: New to Haskell

2007-12-18 Thread Miguel Mitrofanov
Yes, and Haskell can do it also. But C, I guess, can't print out a source code for a function (well, there can be some weird dialects of C I'm not aware about). Haskell can't do it either. Well, LISP can, if I remember it right. Only in an interpreter, if I remember it right.

Re: [Haskell-cafe] [HXT] Simple question

2007-12-19 Thread Miguel Mitrofanov
Hmmm, with 'readString ... this /this' everything works fine, but with 'readString ... itemsthis /this/items' it doesn't. Seems to be a bug in HXT. But if I try the same with my XML file, my empty nodes are folded. I suppose this comes from the Ctrl-M at the end of the lines. See the

Re: [Haskell-cafe] [HXT] Simple question

2007-12-20 Thread Miguel Mitrofanov
I can't really reproduce this: A simple ghci session gives the following: --- [EMAIL PROTECTED]:~/haskell/hxt/curr/examples/arrows/HelloWorld ghci HelloWorld.hs GHCi, version 6.8.1: http://www.haskell.org/ghc/ :? for help Loading package base ... linking

Re: [Haskell-cafe] nice simple problem for someone struggling....

2007-12-21 Thread Miguel Mitrofanov
module Main where data SquareType numberType = Num numberType = SquareConstructor numberType class ShapeInterface shape where area :: Num numberType = shape-numberType data ShapeType = forall a. ShapeInterface a = ShapeType a instance (Num a) = ShapeInterface (SquareType a)

Re: [Haskell-cafe] Functions are first class values in C

2007-12-22 Thread Miguel Mitrofanov
Lazy constant in C: int C1 (){ return 7; } C1 is computed only when you apply the operator () to it. But that's not the point of lazyness. Lazy value is computed only ONCE. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Functions are first class values in C

2007-12-22 Thread Miguel Mitrofanov
That's not C. That's the C preprocessor, which is a textual substitution macro language. Well, the preprocessor is part of the language in a way. These two come together. No. In fact, these are even two different programs, see man cpp. Macros certainly aren't first class (you can't pass

Re: [Haskell-cafe] Functions are first class values in C

2007-12-22 Thread Miguel Mitrofanov
function's expansion is ... just like macro expansion. Then you CAN pass a function to another function. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Functions are first class values in C

2007-12-24 Thread Miguel Mitrofanov
It is true, however, that preprocessing used to be (in pre-standard days) separate from the language. This has not been true for decades. Well, I've seen cpp to be used as a preprocessor not for C sources but for something else. ___ Haskell-Cafe

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
Questions: The fact that Haskell functions are monotone continuous functions on pointed complete partial orders imply this ? - every domain in Haskell is a pointed complete partial order, including domains of functions ? Right. - the structure of a domain is preserved in the result

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
How can I test that partial order in Haskell ? You can't. It's kinda internal. More specifically, if you try to compute a value, which is not maximal in this order, you'll get an error or loop forever. But you still can use such values in your programs if you don't try to compute them. The

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
It sounds like a limit. xn -- x for n -- :-) Yeah, that's right. How can I get that maximal value when I start from a non maximal one ? Not a problem. For example, const 1 maps each value (even (_|_)) to the maximal value 1. [1 .. ] and x=1:x are maximal ? Yes.

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
Right, so when I say to GHCi: Prelude take 5 [1..] and it says: [1,2,3,4,5] then it really has computed the entirety of the infinite sequence [1..], and not some approximation? Of course not! In fact, it doesn't even compute the value 1. It just juggles with the bytes somehow, so that it

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
It sounds like a limit. xn -- x for n -- :-) Yeah, that's right. If xn is monotone, then I only have to worry when it is not bounded, right ? Sorry, don't understand what you mean. Yes, the monotone sequence has a limit. No, it's not necessarily maximal. [1 .. ] and x=1:x are

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
I'll bite. Please, don't. So what do you expect: take 5 [1,2,3,4,5,undefined] to do? Nothing! It's a value, not an instruction! So it does seem to matter how much of the list it evaluates... No, it's implementation details. I'm reasoning about values, not computations, and I use

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-28 Thread Miguel Mitrofanov
take 5 [1,2,3,4,5,undefined] (What would GHCi print? [1,2,3,4,5] Then please square that with your comment that we don't care how much of the list gets evaluated.) I don't care if it evaluates it, reads it's answer from some internal table, or consult it's lawyer. I just want it to

Re: [Haskell-cafe] Doing some things right

2007-12-28 Thread Miguel Mitrofanov
I thought Lisp and Erlang were both infinitely more popular and better known. Certainly not infinitely. Lisp isn't entirely functional, and while Erlang is an industrial success story, I think Haskell is seeing a wider range of application. Well, it seems for me that Erlang is much less

Re: [Haskell-cafe] Doing some things right

2007-12-29 Thread Miguel Mitrofanov
? Kay's definition of OOP necessarily implies imperative behaviour. OCaml has purely functional object update IIRC. That's OK, but it doesn't seem to agree with Kay's definition. Erlang definitely does. ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object

2007-12-29 Thread Miguel Mitrofanov
I'm sure you're at least half-joking, but I'll try to answer you seriously. the same true for thinking. it's you who believe that people are smart by itself but computers are smart only in the bounds they programmed by people. you may believe that human wisdom is created by the Creator (or

Re: Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-29 Thread Miguel Mitrofanov
computers don't make mistakes, don't sleep, don't have their own goals that differ from goals of their society. To Computers Be The Glory! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Re[2]: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-29 Thread Miguel Mitrofanov
ok, please compute 2^2^30 before continuing discussion. Just for the record: I don't think your computer is able to compute 2^ (2^30). ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-29 Thread Miguel Mitrofanov
And, pray, what problem does the nature wants to solve that it thinks in the way of all history until now? May be it's calculating sqrt(2)? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: Re[4]: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-29 Thread Miguel Mitrofanov
as i've said in other letter, both computers and humans may be described using mathematics Erm... What do you really mean by may? I'm pretty sure you can't give such description right now - otherwise you should already have several Nobel prizes. It seems reasonable that even if such

Re: [Haskell-cafe] Re: Re: Re[2]: Wikipedia on first-class object

2007-12-29 Thread Miguel Mitrofanov
In many cases, equality of functions has been decided by humans, as has termination of programs. Of course this doesn't prove that humans can, in principle, decide equality for any pair of functions. But neither has the opposite been proved. It hasn't been proved that we can't build a

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-29 Thread Miguel Mitrofanov
Please, Amateur Philosophy is that way - Please respect others who have signed up to Haskell-Cafe to discuss Haskell and not meaningless drivel. It wasn't intended for me, but I'd like to apologize. I'll try to stop now, but I'm not sure I'd be able to. I need a

Re: Re[6]: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-29 Thread Miguel Mitrofanov
and we already know beautiful examples of scientists being wrong in their assumptions. to be exact, the whole history of science is history of replacing old wrong assumptions with new ones. even most well-known laws of Newtonian physics become obsolete just 300 years later That's completely

Re: [Haskell-cafe] Re: Wikipedia on first-class object

2007-12-30 Thread Miguel Mitrofanov
If I understand correctly, a quantum computer might solve problems in NP in polynomial time, which is assumed not to be possible for deterministic computers. No! Moreover, there is a hypothesis that the only problems quantum computer can solve in polynomial time are those that the usual

Re: [Haskell-cafe] Basic question concerning the category Hask (was: concerning data constructors)

2008-01-06 Thread Miguel Mitrofanov
Take the ordinary disjoint union, and then add a new _|_ element, distinct from both existing copies of _|_ (which are still distinct from each other). Now why is that not the category-theoretic coproduct? h . Left = f and h . Right = g both for _|_ and for finite elements of the types. And it

Re: [Haskell-cafe] Re: US Homeland Security program language security risks

2008-01-06 Thread Miguel Mitrofanov
That's an interesting task: Design a non-touring complete, restricted language in which every expression is decidable, without making the language unusable for usual programming problems. Well, I did something like that a few years ago - it was a sort of assembler language, allowing the

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

2008-01-07 Thread Miguel Mitrofanov
data Stack a = Stack { run :: [a] - (a, [a]) } [...skipped...] But, I have simply no clue how to fix that. :-( Can anybody give my a hint? Yes. It's simply impossible. The Stack data type can't be turned into a monad. May be you can explain what do you want to do with this

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

2008-01-07 Thread Miguel Mitrofanov
Yes. It's simply impossible. The Stack data type can't be turned into a monad. Why not? Surely this is just a variation on the theme of a state monad? Because it can't be turned into a functor. You can't, given a function a - b, construct a function Stack a - Stack b. On the contrast,

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

2008-01-07 Thread Miguel Mitrofanov
What kind of code would you write if it would be such monad? Useless stuff like: s2 = do push 11 push 17 count = push binop (+) binop (*) pop Then you should use something like data Stack a = Stack {run :: [Integer] -

Re: [Haskell-cafe] Newbie question: the need for parentheses

2008-01-08 Thread Miguel Mitrofanov
However, why do I need the parenthes in the second clause? What does the compiler think I'm trying to do when I type suma [] = 0 suma h:t = h + suma t (suma h):t = h + suma t ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Silly question: accessing a slot in a data type

2008-01-09 Thread Miguel Mitrofanov
Also, how do I represent an AddressBook with an empty list and one with data on its list for my pattern matching? phoneLookup (AddressBook []) = Nothing ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

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

2008-01-10 Thread Miguel Mitrofanov
class A a type T = (forall x.Num x=x) instance A T type declares a synonym, like #define in C - but working only on types. So, essentially, you wrote instance A (forall x.Num x = x) which is not very Haskelly. I am simply trying to state that all members of typeclass Num are of typeclass

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

2008-01-10 Thread Miguel Mitrofanov
If I say my name is mark twice, it doesn't mean I belong to set of objects called Mark twice Yes, but instance declaration doesn't only state that some type belongs to some class. It also provides some operations on this type. ___ Haskell-Cafe

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

2008-01-11 Thread Miguel Mitrofanov
However, the fact that (0 / 0) == (0 / 0) yields False is quite shocking. Just for the record: the following is from Firebug (JavaScript debugger for Firefox) session: a = 0/0 NaN a == a false a === a false ___ Haskell-Cafe mailing list

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

2008-01-11 Thread Miguel Mitrofanov
As GNU is not Unix, NaN is not a number, Since NaN /= NaN, I think, we should decipher NaN as Not a NaN instead. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] the trivial monad- thoughts and a question

2008-01-12 Thread Miguel Mitrofanov
The first question I have is it is possible to implement this guy without wrapping the value in a constructor? No. The second question I have is: is there any hope of getting something like this into the standard library? It's there already. It's called Identity monad.

Re: [Haskell-cafe] Cabal-install

2010-03-08 Thread Miguel Mitrofanov
MigMit:~ MigMit$ cabal --help This program is the command line interface to the Haskell Cabal infrastructure. See http://www.haskell.org/cabal/ for more information. ^ | + On 8 Mar 2010, at 19:51, Andrew Coppin wrote: OK, so

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

2010-03-10 Thread Miguel Mitrofanov
Maybe it's just me, but I think composition chain is MUCH easier to read. When readning, I'd probably transform the last version to the previous one by hand, just to make it more comprehensible. Sebastian Fischer wrote: On Mar 10, 2010, at 8:47 AM, Ketil Malde wrote: I think it is better

Re: [Haskell-cafe] FRP, arrows and loops

2010-04-02 Thread Miguel Mitrofanov
1) Haven't look closely, but your second ArrowLoop instance seems righter. The question really is the same as with MonadFix instances; you can always define an instance like this data M = ... -- whatever instance Monad M where ... instance MonadFix M where mfix f = mfix f = f ...but this

Re: [Haskell-cafe] Hackage accounts and real names

2010-04-06 Thread Miguel Mitrofanov
Out of curiosity: is there something wrong with my nickname migmit? I'm not gonna change it anyway. On 6 Apr 2010, at 09:52, Edward Z. Yang wrote: This is a pretty terrible reason, but I'm going to throw it out there: I like real names because they're much more aesthetically pleasing. In

Re: [Haskell-cafe] Re: Haskell.org re-design

2010-04-07 Thread Miguel Mitrofanov
Doesn't seem right. IMHO, the necessity of making windows NOT fullscreen is an indication of bad design. Thomas Davie wrote: On 7 Apr 2010, at 02:53, Ben Millwood wrote: On Wed, Apr 7, 2010 at 2:22 AM, Thomas Schilling nomin...@googlemail.com wrote: I have set a maximum width on purpose so

Re: [Haskell-cafe] and [] = True; or [] = False

2010-04-26 Thread Miguel Mitrofanov
Well, what's the sum of an empty list? Seems naturally that it's 0, but why? Let's say that sum [] = x. If we take two lists, say, l1 = [1,2,3] and l2 = [4,5], then sum l1 + sum l2 = 6 + 9 = 15 = sum [1,2,3,4,5] = sum (l1 ++ l2) We expect it to be the case even if one of the lists is empty,

Re: [Haskell-cafe] and [] = True; or [] = False

2010-04-26 Thread Miguel Mitrofanov
Forgot about this one: Bjorn Buckwalter wrote: What got me thinking about this was the apparently incorrect intuition that 'and xs' would imply 'or xs'. No. See, and is very close to for all, and or is similarly close to exists. For example, the statement all crows are black means just this

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

2010-05-01 Thread Miguel Mitrofanov
It's called monad transformers func1' :: Int - EitherT Error IO String func1' n = EitherT $ func1 n func2' :: Int - EitherT Error IO String func2' s = EitherT $ func2 n runCalc' :: Int - EitherT Error IO [String] runCalc' param = func1' param = func2' runCalc :: Int - IO (Either Error [String])

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

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

Re: [Haskell-cafe] Type of (= f) where f :: a - m b

2010-05-10 Thread Miguel Mitrofanov
(= f) is equivalent to (flip (=) f), not to ((=) f). You can try this with your own function this way: ($^) :: (Monad m) = m a - (a - m b) - m b ($^) = undefined :t ($^ f) Milind Patil wrote: For a function f :: a - m b f = undefined I am having trouble understanding how the type of (=

Re: [Haskell-cafe] Intuitive function given type signature

2010-05-18 Thread Miguel Mitrofanov
On 19 May 2010, at 08:35, Ivan Miljenovic wrote: This looks suspiciously like homework... 2010/5/19 R J rj248...@hotmail.com: What are some simple functions that would naturally have the following type signatures: f :: (Integer - Integer) - Integer I can only think of one solution to

Re: [Haskell-cafe] Retrospective type-class extension

2010-05-20 Thread Miguel Mitrofanov
That won't be a great idea; if I just want my monad to be declared as one, I would have to write instance Functor MyMonad where fmap = ... instance Pointed MyMonad where pure = ... instance Applicative MyMonad where (*) = ... instance Monad MyMonad where join = ... Compare this with instance

Re: [Haskell-cafe] FW: Why does this Ord-class instance crash?

2010-05-21 Thread Miguel Mitrofanov
From Prelude.hs: class (Eq a) = Ord a where compare :: a - a - Ordering (), (=), (), (=) :: a - a - Bool max, min :: a - a - a compare x y = if x == y then EQ -- NB: must be '=' not '' to validate the -- above claim

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

2010-06-17 Thread Miguel Mitrofanov
listFs = [f1, f2, f3] map ($ x) listFs -- same as [f1 x, f2 x, f3 x] f x y z = ... map (\x - f x u v) xs On 17 Jun 2010, at 23:02, Martin Drautzburg wrote: Hello all The standard map function applies a single function to a list of arguments. But what if I want to apply a list of functions

Re: [Haskell-cafe] functional dependencies question

2010-07-01 Thread Miguel Mitrofanov
The class Num has subclasses containing various numeric types and the literal 1 is a value for one or more of those types. Well, the problem is not with subclasses, but with types. ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org

Re: [Haskell-cafe] Associated types

2010-07-01 Thread Miguel Mitrofanov
GADTs? data CompletePathEv p where CompletePathEv :: CompletePath p = CompletePathEv p class Path p = IncompletePath p where type CompletedPath p :: * completedPathEv :: CompletePathEv (CompletedPath p) Later you can pattern-match on completedPathEv and get your CompletePath

Re: [Haskell-cafe] Re: Rewriting a famous library and using the same name: pros and cons

2010-07-03 Thread Miguel Mitrofanov
People still use Hugs? :p Is there another option for quick prototyping on iPhone? ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Subtype polymorphism in Haskell

2010-07-05 Thread Miguel Mitrofanov
My guess is that it's class B : public A and class C : public A In this case it seems perfect to use type classes: class A t where do_x :: t - Integer - Integer - Integer data B = ... instance A B where do_x b x y = ... data C = ... instance A C where do_x c x y = ... If you want some general

Re: [Haskell-cafe] Subtype polymorphism in Haskell

2010-07-06 Thread Miguel Mitrofanov
of the haskell textbooks, and if anyone knows of a good in-depth treatment of this, I would be grateful for a pointer. Thanks again to everyone who responded, Simon On Mon, Jul 5, 2010 at 2:28 PM, Miguel Mitrofanov miguelim...@yandex.ru mailto:miguelim...@yandex.ru wrote: My guess is that it's

Re: [Haskell-cafe] RE: Design for 2010.2.x series Haskell Platform site (Don Stewart)

2010-07-17 Thread Miguel Mitrofanov
Well, Linux fanboys are known for spending too much time with their computers compiling OS kernel or building world, no surprise their eyes aren't in place. On 18 Jul 2010, at 02:54, bri...@aracnet.com wrote: On Sat, 17 Jul 2010 18:02:05 -0400 Brandon S Allbery KF8NH allb...@ece.cmu.edu

Re: [Haskell-cafe] Has character changed in GHC 6.8?

2008-01-22 Thread Miguel Mitrofanov
chr . ord $ 'å' '\229' What would I have to do to get an 'å' from '229'? It seems you already have it; 'å' is the same as '\229'. But IO output is still 8-bit, so when you ask ghci to print 'å', you get '\229'. You can use utf-string library (from hackage).

Re: [Haskell-cafe] anybody can tell me the pronuncation of haskell?

2008-01-29 Thread Miguel Mitrofanov
On 29 Jan 2008, at 20:21, Anton van Straaten wrote: Froprakxculmizum troodulifnax! Bless you! ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Relevance and applicability of category theory

2008-01-30 Thread Miguel Mitrofanov
1. Are Haskell monads useful in a truly categorical sense? 2. Is Haskell's functor class misnamed? 3. Haskell arrows and Haskell monads have a misleading relationship I'm confused. It seems for me that either I don't understand math or I don't understand you. 1. Categorical monads are a

Re: [Haskell-cafe] fmap vs. liftM

2008-02-04 Thread Miguel Mitrofanov
Problem is that from the idea Functor is a superclass of Monad, with the property that fmap == liftM. [cut] The second relation can even not be expressed in Haskell 98. Erm... class Functor f where fmap :: (a - b) - f a - f b class Functor m = Monad m where return :: a - m a

Re: [Haskell-cafe] Inverting a Monad

2008-02-06 Thread Miguel Mitrofanov
invM :: Maybe a - Maybe () invM Nothing = Just () invM (Just _) = Nothing invL :: [] a - [] () invL []= [()] invL (_:_) = [] How can I define this for an arbitrary Monad m? Such as Identity? ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Inverting a Monad

2008-02-06 Thread Miguel Mitrofanov
Such as Identity? Well in: inv :: (Monad m, ...) = m a - m () inv m = ... I don't mind that there are more constraints on 'm' than just Monad class Monad m = MonadInv m where inv :: m a - m () With this constraint you certainly can have your inv.

Re: [Haskell-cafe] A question about monad laws

2008-02-11 Thread Miguel Mitrofanov
(x = f) = g == x = (\v - f v = g) However, this seems to me a kind of mathematical identity. If it is mathematical identity, a programmer need not care about this law to implement a monad. Can anyone give me an example implementation of monad that violate this law ? It's well known that ListT

Re: [Haskell-cafe] Parody of Darcs patch theory from 1981

2008-03-02 Thread Miguel Mitrofanov
Does it start with Any sequence of KLUDGES, not necessarily distinct or finite...? If so, it can be found in The Computer Contradictionary, by the same author, and probably illegal copy of the last book can be found in the net somewhere. On 2 Mar 2008, at 19:53, Paul Johnson wrote: I was

Re: [Haskell-cafe] Functional programmer's intuition for adjunctions?

2008-03-04 Thread Miguel Mitrofanov
Well, we have at least one very useful example of adjunction. It's called curry. See, if X is some arbitrary type, you can define type F = (,X) instance Functor F where fmap f (a,x) = (fa,x) type G = (-) X instance Functor G where fmap f h = \x - f (h x) Now, we have the adjunction:

Re: [Haskell-cafe] Re: Functional programmer's intuition for adjunctions?

2008-03-04 Thread Miguel Mitrofanov
Well, I think it's really cool to be sitting in cafe exchanging some сute facts from category theory we happen to know. Girls would definitely like it. On 5 Mar 2008, at 03:33, Derek Elkins wrote: On Tue, 2008-03-04 at 19:01 +, Dominic Steinitz wrote: Well, we have at least one very

Re: [Haskell-cafe] simple Haskell question - List comprehensions

2008-03-09 Thread Miguel Mitrofanov
Exercise: Show how the single comprehension [(x,y) | x - [1,2,3], y - [4,5,6]] with two generators can be re-expressed using two comprehensions with single generators. Hint: make use of the library function _concat_. Another hint: it can be rewritten as concatMap (\x - concatMap (\y -

Re: [Haskell-cafe] Recursion problem in infinite list model

2008-03-27 Thread Miguel Mitrofanov
Hmmm, seems like your (-+) is not lazy enough. Since pattern matching is strict by default, you have anything -+ (_|_) = (_|_) Therefore, the function, which is constantly (_|_), is a fixed point for the equation defining h. In other words, if you define h' x = undefined then you have h'

Re: [Haskell-cafe] Strange behavior of float literals

2008-04-05 Thread Miguel Mitrofanov
I don't know if it is a bug, but 1 = 0 (mod 2^32), so, if GHC considers exponent as Int (not Integer), then it's the same as 1e0 = 1. In the same way, 9 = -1 (mod 2^32), and 1e-(-1) = 1e1 = 10. Note

Re: [Haskell-cafe] ANNOUNCE: Generic Haskell 1.80 (Emerald)

2008-04-12 Thread Miguel Mitrofanov
Generic Haskell includes the following features: * type-indexed values -- generic functions that can be instantiated on all Haskell data types. How come I haven't ever heard about such a thing?! ___ Haskell-Cafe mailing list

Re: [Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Miguel Mitrofanov
It has nothing to do with State; it actually works in List monad. return y is just another way of writing [y]. You don't need to import Control.Monad.State for this to work; you only need Control.Monad (which is imported by the former). On 16 Apr 2008, at 16:56, Hans Aberg wrote: When I

Re: [Haskell-cafe] Funny State monad dependency

2008-04-16 Thread Miguel Mitrofanov
Before somebody noticed: I'm wrong. It's not List monad, but also a (-) x monad, also defined in Control.Monad. Therefore, return y is just const y. Therefore, x = (return y) = x = (const y) = x y On 16 Apr 2008, at 17:04, Miguel Mitrofanov wrote: It has nothing to do with State

Re: [Haskell-cafe] Re: I/O system brokenness with named pipes

2008-04-16 Thread Miguel Mitrofanov
You are insulting other Unixes. It works on Mac OS X, for example. On 16 Apr 2008, at 19:16, John Goerzen wrote: On 2008-04-15, Joe Buehler [EMAIL PROTECTED] wrote: John Goerzen wrote: So I have a need to write data to a POSIX named pipe (aka FIFO). Long story involving a command that

Re: [Haskell-cafe] Function Type Calculation (Take 2)

2008-04-27 Thread Miguel Mitrofanov
[1] funk f x = f (funk f) x f :: a x :: b funk f x :: c therefore funk :: a - b - c RHS f (funk f) x :: c f (funk f) :: d - c x :: d f :: e - d - c funk :: h - e f :: h

Re: [Haskell-cafe] Understanding tail recursion and trees

2008-05-01 Thread Miguel Mitrofanov
Copy-paste approach's failed you. Hint: try removing acountL definition and compiling everything else. -- count with tail calls for the left subtree acountL :: Tree - Integer - Integer acountL (Leaf _) acc = acc + 1 acountL (Branch t1 t2) acc = acountL t1 $! (acountL t2 acc) -- count

Re: [Haskell-cafe] Order of Evaluation

2008-05-09 Thread Miguel Mitrofanov
On 9 May 2008, at 21:52, PR Stanley wrote: Hi (take 4 . map (0)) (f s t) where s = 2 : t t = 3 : s f = zipWith (-) What would be the order of evaluation for the above code? How would I illustrate the evaluation step-by-step? What do you need it for, really? Pure functional

Re: [Haskell-cafe] Order of Evaluation

2008-05-09 Thread Miguel Mitrofanov
As I understand it Haskell does not specify an order of evaluation and it would therefore be a mistake to write a program which relies on a particular evaluation order. This is the 'unsafe' aspect of unsafePerformIO. Hmm... IMHO unsafePerformIO is 'unsafe' because it can lead to type errors

Re: [Haskell-cafe] MonadPlus

2008-05-09 Thread Miguel Mitrofanov
On 10 May 2008, at 00:43, Dan Piponi wrote: Andrew asked, ...so it's a kind of choice operator? Run all actions until you get to one that succeeds and return the result from that? The eternal bit of trickiness for Haskell is that type classes group often together things that people don't

Re: [Haskell-cafe] Re: Order of Evaluation

2008-05-09 Thread Miguel Mitrofanov
use unsafePerformIO. Indeed, it is possible to write coerce :: a - b with the help of unsafePerformIO. So be careful! /quote That's the reason why f has sometimes LESS general type than \x - f x in OCaml. On 10 May 2008, at 01:34, Achim Schneider wrote: Miguel Mitrofanov [EMAIL PROTECTED

Re: [Haskell-cafe] Std lib equivalent for liftM concat . sequence

2008-05-16 Thread Miguel Mitrofanov
Seems to be close to sequence :: [ListT m a] - ListT m a Hmm? On 16 May 2008, at 14:12, Alistair Bayley wrote: A couple of days ago I had need for: concatM :: Monad m = [m [a]] - m [a] concatM = liftM concat . sequence but found no such thing in the std libs, except perhaps for msum (I

  1   2   3   4   5   >