Re: [Haskell-cafe] Poll: Do you want a mascot?

2011-11-24 Thread Victor Nazarov
Haskell-Cafe@haskell.org >> http://www.haskell.org/mailman/listinfo/haskell-cafe >> >> > > > > -- > Work is punishment for failing to procrastinate effectively. > > ___ > Haskell-C

Re: [Haskell-cafe] Tupling functions

2011-09-14 Thread Victor Nazarov
ce Tuple (Tuple1 a) instance NTuple (Tuple1 a) where type THead (Tuple1 a) = a type TTail (Tuple1 a) = () thead (Tuple1 a) = a ttail (Tuple1 a) = () tcons a b = Tuple1 a instance Tuple (a, b) instance NTuple (a, b) where type THead (a, b) = a type TTail (a, b) = Tuple

Re: [Haskell-cafe] Why the reluctance to introduce the Functor requirement on Monad?

2011-07-26 Thread Victor Nazarov
id -- default instances: instance Functor m where fmap f a = a >>= (return . f) newtype Reader a b = Reader { runReader :: a -> b } -- instace declaration: instance Monad (Reader r) where return = Reader . const m >>= f = Reader $ \r -> runReader (f (runReader m r)) r deriving (Functor) So syntax changes are very minor. -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] ANN: unordered-containers - a new, faster hashing-based containers library

2011-02-23 Thread Victor Nazarov
tion in unordered-containers package. Also I think that value of hash functions is obviously a Monoid and it will be convenient to have Monoid instance newtype Hash = Hash Int instance Monoid Hash where mempty = Hash 0 Hash a `mappend` Hash b = Hash (a `combine` b) c

Re: [Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-28 Thread Victor Nazarov
On Wed, Oct 27, 2010 at 7:46 PM, Martijn Schrage wrote: > On 27-10-10 16:20, Victor Nazarov wrote: >> >> Very cool. I'll incorporate your changes, If you don't mind. > > Not at all. >> >> However, I have some minor remarks. >> You shouldn

Re: [Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-27 Thread Victor Nazarov
;>    main = simpleHTTP nullConf (fileServe [] "./") > > I wasn't able to run it in Chrome without dedicated HTTP-server, seems like it is the only way... -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-27 Thread Victor Nazarov
On Wed, Oct 27, 2010 at 4:30 PM, Martijn Schrage wrote: > On 21-10-10 01:01, Victor Nazarov wrote: >> >> I've been working on this for some month and I think now I'm ready to >> share the results. > > Great stuff! I've been looking for something

Re: [Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-21 Thread Victor Nazarov
On Thu, Oct 21, 2010 at 6:35 AM, Richard O'Keefe wrote: > > On 21/10/2010, at 12:01 PM, Victor Nazarov wrote: > >> I've been working on this for some month and I think now I'm ready to >> share the results. > > Given that this is alpha code, what&#

[Haskell-cafe] [ANNAUNCE] ghcjs-0.1.0 Haskell to Javascript compiler

2010-10-20 Thread Victor Nazarov
el free to experiment with it as you wish. Implementation -- Compiler is implemented as [GHC](http://www.haskell.org/ghc/) backend using GHC API. And been tested with GHC 6.12.1. -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskel

Re: [Haskell-cafe] Suggestions for improvement

2010-10-03 Thread Victor Nazarov
Control.Arrow: >> >>    blowup = uncurry (++) . (blowup . allButLast &&& lastToTheLength) > > Or you can write it as (liftA2 (,)) as I noted a few lines further in my mail > ;) > > Dominique > ___ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Re: Coding conventions for Haskell?

2010-09-27 Thread Victor Nazarov
f a b | a > 0 = FisrtConstructor a | otherwise = SecondConstructor g where g = h b h = id main = do putStrLn hello putStrLn . concat [ hello , show (f 25 1) ] flip mapM_ [1..100] $ \n -> do print n putStrLn hello where he

Re: [Haskell-cafe] Announce: lhae

2010-09-03 Thread Victor Nazarov
> - Export to gnuplot diagrams (currently bar charts and box plots) > - Multilingual (english, german) > > Here [1] is some documentation about how to build lhae and how to use the > formula language. > I was thinking about writing my own. What I wanted was adding lists and fun

Re: [Haskell-cafe] Playing with ATs again

2010-08-04 Thread Victor Nazarov
Bijection a b where >   ... > > I agree, the fact that this doesn't work is really dumb. > I think it is more simple like: class Bijection a b where ... type LeftToRight a = (Bijection a b) => b type RightToLeft b = (Bijection a b) => a -- Victor Nazarov ___

[Haskell-cafe] Data types a la carte

2010-07-21 Thread Victor Nazarov
y logic defines some basic combinators > data CombinatorObjF a = CK | CS > type Cominator = Mu (ApplicativeF :<*> CombinatorObjF) > instance Show (CombinatorObjF a) > where showsPrec d CK = showString "K" > showsPrec d CS = showString "S" > test3 = s `app` k `app` k `app` (k `app` s) > where s = Mu . S . Flip . Obj $ CS > k = Mu . S . Flip . Obj $ CK > app a b = Mu . S . Flip $ App a b -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

Re: [Haskell-cafe] Why this doesn't type checked

2010-06-27 Thread Victor Nazarov
On Mon, Jun 28, 2010 at 12:33 AM, Daniel Fischer wrote: > On Sunday 27 June 2010 21:52:18, Victor Nazarov wrote: >> I've allways found code like >> >> > -- maxBound (undefined :: Int) >> >> a bit strange > > Well, that would indeed be a bit strange

[Haskell-cafe] Why this doesn't type checked

2010-06-27 Thread Victor Nazarov
Sizeof' is a type function, and may not be injective In the first argument of `print', namely `(sizeof :: Sizeof Word16)' In the expression: print (sizeof :: Sizeof Word16) In the expression: do { print (sizeof :: Sizeof Word16) } What can I do with this code to mak

Re: [Haskell-cafe] GUI programming

2010-02-08 Thread Victor Nazarov
On Fri, Feb 5, 2010 at 9:54 PM, Mario Blažević wrote: > Victor Nazarov wrote: >> >> Hello, >> >> I've been writing some GUI application with Gtk2hs. It's an >> interpreter for lambda-calculus and combinatory logic, it's GPL and if >> you int

Re: [Haskell-cafe] Re: GUI programming

2010-02-03 Thread Victor Nazarov
On Wed, Feb 3, 2010 at 4:11 PM, Heinrich Apfelmus wrote: > Victor Nazarov wrote: >> data Behaviour a = >>   forall b. BBind (Behaviour b) (b -> Behaviour a) >>   | BIO (IO a) >>   | forall obj. GObjectClass obj => BWaitEvent (Event obj) (Behaviour a) >>

[Haskell-cafe] GUI programming

2010-02-02 Thread Victor Nazarov
(onClicked button) buttonB (label ++ "*") runBehaviour (buttonB "*") set window [containerChild := button] widgetShowAll window mainGUI -- Victor Nazarov {-# LANGUAGE ExistentialQuantification #-} module Main where import Data.IORef import S

[Haskell-cafe] diff implementation in haskell

2009-12-06 Thread Victor Nazarov
a where > type Difference a > diff :: a -> a -> Difference a > patch :: a -> Difference a -> a > > prop_diffpatch a b = patch a (diff a b) == b ? If not, where can I start towards the implementation? What's the way to do it more functionally? -- Victor Nazar

Re: [Haskell-cafe] Problem with type families

2009-09-21 Thread Victor Nazarov
On Tue, Sep 22, 2009 at 1:31 AM, Daniel Fischer wrote: > Am Montag 21 September 2009 23:15:48 schrieb Victor Nazarov: >> I've tried to reimplement code presented in the following blog post: >> http://cdsmith.wordpress.com/2009/09/20/side-computations-via-type-classes/ >

[Haskell-cafe] Problem with type families

2009-09-21 Thread Victor Nazarov
xs addRows q m n (ListMatrix xs) = ListMatrix $ modifyNth n (zipWith comb (xs !! m)) where comb a b = q * a + b addCols q m n (LisMatrix xs) = ListMatrix $ map (\row -> modifyNth n (comb (row !! m)) row) where comb a b = q * a + b ... How can I fix this?

[Haskell-cafe] Re: FastCGI error handling

2009-08-03 Thread Victor Nazarov
On Mon, Aug 3, 2009 at 4:32 PM, Victor Nazarov wrote: > I've been trying to write some simple web application in haskell using > FastCGI, HDBC and HStringTemplate. I've got stuck with the following > problem. > [snip] > > main :: IO () > -- main = runFastCGIConcurren

[Haskell-cafe] FastCGI error handling

2009-08-03 Thread Victor Nazarov
main :: IO () -- main = runFastCGIConcurrent' forkIO 10 (handleErrors test) -- This allways gives internal error without a chance to find out what happens main = runFastCGI $ handleErrors test -- This works fine So one variant of main function works, the other allways gives no output.

Re: [Haskell-cafe] Leksah works!

2009-07-23 Thread Victor Nazarov
k-0.10.1, stm-2.1.1.2, svgcairo-0.10.1, syb-0.1.0.1, template-haskell-2.3.0.1, time-1.1.4, unix-2.3.2.0, utf8-string-0.3.5, xhtml-3000.2.0.1, zlib-0.5.2.0 /home/vir/.ghc/i386-linux-6.10.4/package.conf: Cabal-1.6.0.1, Cabal-1.6.0.3, binary-0.5.0.1, utf8-string-0.3.5 -- Victor Naza

Re: [Haskell-cafe] Slightly off-topic: Lambda calculus

2009-06-21 Thread Victor Nazarov
> counter-example as yet. If somebody here can provide either a proof or a > counter-example, that would be helpful. > It seems obvious scince beta reduction never introduces new variales... -- Victor Nazarov ___ Haskell-Cafe mailing list Has

Re: [Haskell-cafe] calling a variable length parameter lambda expression

2009-05-07 Thread Victor Nazarov
typing... This solution is not the Haskell way and should be avoid. -- Victor Nazarov > On Wed, May 6, 2009 at 11:41 AM, Nico Rolle wrote: > > super nice. > > best solution for me so far. > > big thanks. > > regards > > > > 2009/5/6 Victor Nazarov : >

Re: [Haskell-cafe] calling a variable length parameter lambda expression

2009-05-06 Thread Victor Nazarov
x (unfold_parameters parameters) > Why not: lam1 = \[x, y] -> x > y lam2 = \[x, y, z, a] -> (x > y) && (z < a) doLam :: Ord a => ([a] -> Bool) -> [a] -> Bool doLam lam params = lam params So, this will work fine: doLam lam1 [1, 2] doLam lam2 [1,2,3,4] -- V

Re: [Haskell-cafe] Re: Cabal's default install location

2009-04-22 Thread Victor Nazarov
t the whole hierarchy is managed by single tool cabal. Drawback is that you should add /var/lib/cabal/bin into your PATH. -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe

[Haskell-cafe] History data structure suggestion

2009-04-12 Thread Victor Nazarov
History a -> History a goTo (HP n) = foldr1 (.) (replicate n forward) . start I wonder is there more effective, more easy to implement data structure to represent History and HistPoint -- Victor Nazarov ___ Haskell-Cafe mailing list Haskell-Cafe@haskel

[Haskell-cafe] base-4 + gtk2hs-0.10.0 licensing

2009-02-25 Thread Victor Nazarov
I wonder what software licence I can use to release my application. I've developed some education tool with the following dependencies: % ghci Main.hs GHCi, version 6.10.1: http://www.haskell.org/ghc/ :? for help Loading package ghc-prim ... linking ... done. Loading package integer ... linking .

[Haskell-cafe] Help using catch in 6.10

2009-02-20 Thread Victor Nazarov
Hello, cafe. I whant to switch to GHC 6.10 My application compiled fine with 6.8.3, but after switchin to 6.10, I've got errors about usage of catch function: Main.hs:165:14: Ambiguous type variable `e2' in the constraint: `Exception e2' arising from a use of `catch' at Main.hs:165:14-

Re: [Haskell-cafe] Re: Datatypes - Haskell

2008-02-10 Thread Victor Nazarov
On Feb 10, 2008 3:40 PM, Mattes Simeon <[EMAIL PROTECTED]> wrote: > Thanks for your help. It was very useful. > > Though in comparison with C or C++ I can't figure out so clear the syntax. > Maybe it has to do with the syntactic Sugar of each Language. I 'll give you a > similar example I saw in a

Re: Re[2]: The programming language market (was Re: [Haskell-cafe] Why functional programming matters

2008-01-27 Thread Victor Nazarov
On Jan 27, 2008 11:49 AM, Bulat Ziganshin <[EMAIL PROTECTED]> wrote: > oh, yes, they are really still study 19th century physics, but not > because of great mind, but due to age of university professors. i've > studied at Moscow University in 89-91 and department of computer > languages still studi

Re: [Haskell-cafe] Re: Displaying steps in my interpreter

2008-01-11 Thread Victor Nazarov
On Jan 10, 2008 8:39 PM, apfelmus <[EMAIL PROTECTED]> wrote: > Victor Nazarov wrote: > > > Yes, there is: you can use a zipper > >http://en.wikibooks.org/wiki/Haskell/Zippers > > Here's how: > >data Branch v = AppL (Term v) >

Re: [Haskell-cafe] \_ -> not equivalent to const $

2008-01-10 Thread Victor Nazarov
On Jan 11, 2008 2:28 AM, Felipe Lessa <[EMAIL PROTECTED]> wrote: > On Jan 10, 2008 9:20 PM, Luke Palmer <[EMAIL PROTECTED]> wrote: > > Ahh, it was ghc 6.8.1, without any optimization. If I turn on optimization, > > the behavior goes away, and they both behave like the const version. > > That was w

Re: [Haskell-cafe] \_ -> not equivalent to const $

2008-01-10 Thread Victor Nazarov
On Jan 11, 2008 2:11 AM, Felipe Lessa <[EMAIL PROTECTED]> wrote: > On Jan 10, 2008 8:54 PM, Luke Palmer <[EMAIL PROTECTED]> wrote: > > Can someone explain what the heck is going on here? > > AFAICT, nothing is wrong. You see, both returned the very same values. [snip] > But referential transparency

[Haskell-cafe] Displaying steps in my interpreter

2008-01-10 Thread Victor Nazarov
Hello, I have little practice in Haskell. And I look forward for suggestions on how to improve the code. Code is not working: some definitions are missed. The goal of the code is to implement the evaluator for untyped lambda-calculus. The main problem is how to display each step of reduction? More

Re: [Haskell-cafe] Re: distinguish functions from non-functions in a class/instances

2007-12-07 Thread Victor Nazarov
On Dec 7, 2007 4:46 PM, Luke Palmer <[EMAIL PROTECTED]> wrote: > On Dec 7, 2007 6:27 AM, Victor Nazarov <[EMAIL PROTECTED]> wrote: > > > > nary 0 x [] = x > > nary n f (x:xs) | n > 0 = nary (n-1) (f $ read x) xs > > Sometimes it helps to write type si

Re: [Haskell-cafe] Re: distinguish functions from non-functions in a class/instances

2007-12-07 Thread Victor Nazarov
On Dec 7, 2007 2:52 PM, <[EMAIL PROTECTED]> wrote: > > In fact, that distinction is possible. The following article > > How to write an instance for not-a-function > http://okmij.org/ftp/Haskell/typecast.html#is-function-type > > specifically describes a method of writing an instan

Re: [Haskell-cafe] Why not assign a type to unsafePerformIO?

2007-10-03 Thread Victor Nazarov
On 10/4/07, Justin Bailey <[EMAIL PROTECTED]> wrote: > On 10/3/07, Victor Nazarov <[EMAIL PROTECTED]> wrote: > > But how would you know that evil dictator uses unsafePerformIO??? > > You don't. unsafePerformIO can't be taken it away (there are legitimate &

Re: [Haskell-cafe] distghc possible?

2007-09-27 Thread Victor Nazarov
> i am a newbie in haskell. > i have read about the tool distcc, http://distcc.samba.org/. > so i was wondering, does something like this already exist for > haskell? > would it be possible to implement a similar tool based on ghc for > haskell or does this not make sense as a haskell program has t

[Haskell-cafe] Haskell guards

2007-09-20 Thread Victor Nazarov
I still can't remember how guards are treated in Haskell. Here is the code snippet in question: foo a | a == 1 = 6 foo a | a == 2 = 7 foo a = 8 Would Haskell fall through to the third alternative if a is not equal to 1 or 2. I know that this can be rewritten more sanely, but I just consider guard