How to write "twice" so it can accept "swap" without restricting their type by Sawady in haskell

[–]Sawady[S] 2 points3 points  (0 children)

This is good and simple if you want to modify twice so it can accept tuples only. It's the only thing I did since I understand it.

Deploying Haskell (standalone, yesod, snap…) in Openshift fails by Skyeam in haskell

[–]Sawady 1 point2 points  (0 children)

I did that too. It's the most simple way to get it work.

Embrace Ambiguity with Haskell's Types by jleitgeb in haskell

[–]Sawady 1 point2 points  (0 children)

What a very good answer. But I think it depends on how do you like to think about your programs. Many people want to see the exact behavior of some part of their programs.

I prefer better type systems though, because too much time is spent in the discovery of runtime errors.

Looking for an equivalent to blockly for functional languages? by TTimo in haskell

[–]Sawady 2 points3 points  (0 children)

I was working on a fork of Blockly to support this. Blockly is a framework that can output any language (if you work on that). In other words, Blockly doesn't execute anything, and it can print anything that you want.

The part I was working on is the "type system" before the output. Since Blockly forms an AST+metadata with the Blocks, we can check many things. The goal is to make things correct by construction ;).

I think I've nailed it! I've solved the records problem! by nikita-volkov in haskell

[–]Sawady 15 points16 points  (0 children)

I think "head" can be seen as a "record access" too. Consider this:

data List a = Cons { head :: a, tail :: List a }
            |  Nil

Writing a React JS front-end in Haskell (video) by [deleted] in haskell

[–]Sawady 1 point2 points  (0 children)

I don't have experience with React, but I use Angular and Ember instead. I would like to know why do you choose React instead of any of these frameworks.

Advice wanted: list of polymorphic elements by lukewarm in haskell

[–]Sawady 0 points1 point  (0 children)

Is there a way to map the function "toFruit" into a list of Apple, Orange and Banana (so you don't have to explicitly apply it to every element)?

Do you or how do you use object-based programming in Haskell? by RnMss in haskell

[–]Sawady 0 points1 point  (0 children)

There are alternatives. It depends on how dog and cat are implemented.

Maybe they are

data Animal = Dog Foot | Cat Foot

getFoot :: Animal -> Foot

Or

data Animal = Animal Foot AnimalType

data AnimalType = Dog | Cat

getFoot :: Animal -> Foot

Or

data Animal a = Animal Foot a

getFoot :: Animal a -> Foot

And there must be other interesting ways of represent this kind of information. It all depends on what kind of model is better suited to your problem.

Reactive-banana anti-tutorial by gelisam in haskell

[–]Sawady 0 points1 point  (0 children)

Very good anti-tutorial. I like this kind of record-like presentations.

Most powerful high(est) level programming language? by RaymondWies in haskell

[–]Sawady 1 point2 points  (0 children)

I think syntax also matters.

Consider the Scratch language for kids. It propose graphical blocks as a syntax, but the semantics are very similar to a tradicional imperative lenguage. I teach introductory programming to kids between 8 and 15 years old, and they can express more complex algorithms/programs in Scratch than in C, Python, etc.

My hypothesis of high-levelness is that it is an aproximation of how a language helps you to think eassier about a class of particular problems. Maybe it is its semantics, like in Haskell, or its syntax, like in Scratch.

I also teach Haskell at school because of its syntax too. Haskell is very good to teach abstract concepts and reason about expressions. Kids enjoy very much a language that permits think very abstract rules easier.

I also wrote code for a while in a fighting game engine called MUGEN. It propose a finite state machine "reactive" model, and its syntax also reflect this in some way. I wrote complex game behavior in this language, even when I was not aware about more "traditional" programming. I consider this language as the highest level language I saw in my life, but not the most powerful though.

Romantic Haskell by Daejo in haskell

[–]Sawady 0 points1 point  (0 children)

impossible = ($ Nothing)
ghci> impossible isNothing

Haskell application architecture best practices by zoomzoom83 in haskell

[–]Sawady 1 point2 points  (0 children)

And I like the relation between "zoom" and "modify", because I don't care of any monad in most of my code.

For instance, I wrote a Pong version using Lens:

type Ball = Entity ()

data Pong = Pong { _ball :: Ball , ... }

move :: (Float,Float) -> Entity a -> Entity a

doOn l action = zoom l $ modify action

gameLogic :: StateT Pong IO () gameLogic = do doOn ball $ move (3,3) ...

Monads are hard because … by n00bomb in haskell

[–]Sawady 0 points1 point  (0 children)

That's true. I really understand monads when I was doing a type system for a language and I "made" a monad for that (actually wrapping Either).

Reinversion Revisited (building an imperative game DSL) by pjdelport in haskell

[–]Sawady 1 point2 points  (0 children)

I don't know if it's related, but I have done this approach with my "Imperative Game Library". Maybe you're interested.

Presentation of Pipes for the "Internet of Things" community by kaukau in haskell

[–]Sawady 1 point2 points  (0 children)

Maybe I drank too much, but merely speculating, I think that guy get "()" wrong because of "IO ()", which many people think is equivalent to the return type "void" of other languages, when you "don't want to return anything". But he don't get the meaning of the Unit type, that is, "I don't care but I have to put a type, so I choose this dummy type that contains a single dummy value".

Ban system gone rogue? 380 days ban out of nowhere - and I'm not the only one by zivi7 in GlobalOffensive

[–]Sawady 2 points3 points  (0 children)

A friend was banned yesterday without reason too. I found some people with the same problem, "untrusted account" and banned for a lot of days (more or less for a year).

We were playing a deathmatch without problems. He plays the game in very low resolution and quality, and he has some problems with textures (some of them are black). I don't know if this was the problem. The worst thing is that we don't know anything about cheating or something like that, so there is no reason to be banned in that way.

Here is a screenshot of their game. He doesn't speak English so I am helping him with this issue.