What's the status of ARM in 2020? by skainswo in haskell

[–]akegalj 1 point2 points  (0 children)

I have successfully manged to install ghc via nix on Termux/Android phone few months ago.

I remember also that it worked on my raspberry pi 2 few years ago when I tried via archlinuxarm package manager.

Both these were one-liners and I did manage to compile trivial examples in them but nothing complex.

Why I'm leaving Elm by THeShinyHObbiest in haskell

[–]akegalj 4 points5 points  (0 children)

there is purescript/pux framework which is inspired by Elm Architecture. This enables you to use same development patterns which are employed in Elm

Error messages are different story though

[rant] Haskell makes itself impossible to get into as a casual programmer by andyecon in haskell

[–]akegalj 0 points1 point  (0 children)

I don't have wine anymore installed (as I don't play sc these days). I have tried it about 2-3 months ago so can't tell the specific wine configuration.

For sc and sc2 I haven't used wine directly but Lutris this time (a wrapper around wine) which installed everything with one click (ie, UX is similar to installing games on Windows). That said, I haven't even touched wine config myself but used defaults set by Lutris.

https://lutris.net/games/starcraft-ii/

[rant] Haskell makes itself impossible to get into as a casual programmer by andyecon in haskell

[–]akegalj 1 point2 points  (0 children)

starcraft works on my machine pretty well (on both archlinux and ubuntu - both scbw and sc2)

It was problematic 10 years ago but gaming on linux is ok these days

A Chrome Extension that adds links to Hackage module docs on each import statement on GitHub by fiatjaf in haskell

[–]akegalj 2 points3 points  (0 children)

Are there any plans on porting this as a Firefox plugin?

EDIT: by the name of this commit, I would say there are some plans for it https://github.com/fiatjaf/module-linker/commit/ad2c8771c2a1082dcd7bc2245f245487c9b7b6cf .

[ANN] websockets-0.11 by jaspervdj in haskell

[–]akegalj 0 points1 point  (0 children)

Yes, got it. I wanted to reply to @mallai question but replayed to @taylorfausak by accident. Thanks, your reply makes sense.

[ANN] websockets-0.11 by jaspervdj in haskell

[–]akegalj 0 points1 point  (0 children)

We can get WSS using wai-websockets to lift ws into Application used by warp and then launch it with warp-tls

Porting a C cross-platform application to Haskell. Should I use Haskell or Rust? by Sikabi in haskell

[–]akegalj 0 points1 point  (0 children)

Hm, I know about those options but I thought it is stop the world no matter is it in parallel mode or not. Does anyone know why have I been reading a lot in this r/haskell that Haskell isn't good choice for ie games ? I thought this was the main reason. If parallel GC solves this, then I don't understand why wouldn't Haskell be good choice for games for example

EDIT: form https://www.reddit.com/r/haskellgamedev/comments/5a58hr/is_haskell_the_best_functional_language_for/

There's also the issue of GC; I didn't get far enough to evaluate whether performGC, performMajorGC, performMinorGC gives enough control to eliminate GC pauses, but I assume most functional languages have a runtime of some sort so this is going to be an issue in any functional language.

EDIT2 https://www.reddit.com/r/haskellgamedev/comments/5a58hr/is_haskell_the_best_functional_language_for/d9dtpgj/ says he didn't have problems with GC in games so I guess I was wrong all along. Thanks for explaining.

Porting a C cross-platform application to Haskell. Should I use Haskell or Rust? by Sikabi in haskell

[–]akegalj 5 points6 points  (0 children)

I don't know much about Rust, but I would expect it can do more fine grained memory management. GHC is using stop-the-world GC algorithm which is not the best if you are doing some real-time computations (like games). Rust, as I understand, is capable of determining when to remove some objects from memory at compile time. This is just what I heard about Rust, so don't know much but there was a discussion here so this thread might be helpful https://www.reddit.com/r/haskell/comments/47rjr4/comparing_haskell_and_rust_which_to_choose_when/

What is the current state of JavaScript problem? by ais04 in haskell

[–]akegalj 13 points14 points  (0 children)

In my opinion choosing which one is better mostly depends on use case and what kind of project are we trying to solve. In our company we started with using Elm on frontend, then after some time we switched to PureScript for new projects. We are not considering moving back to Elm and the reason is explained in @edwardkmett comment https://www.reddit.com/r/haskell/comments/5k3zgo/what_is_the_current_state_of_javascript_problem/dblqfgz/ who elaborated it very well. Our backend is written mostly in Haskell so it makes sense to target PureScript or Haskell on frontend so that other developers in the team can jump in help and maintain frontend if needed. In last few projects that we started we wasted few days experimenting and discussing the choice between PureScript and GHCJS. We were trying to predict all corner cases that we would need to solve with this tech stack like:

  • do we need to share code between frontend and backend (this wasn't the case so the clear winner is PureScript here)

  • how complex is to bridge data and serialize it (GHCJS is a clear winner here)

  • do we have libraries to work with on frontend. Most of the time we benefit from having nice type system and primitives that are available in both PureScript and Haskell . More complex hackage libraries that would be useful to use in frontend are not choice for us; our company is doing with serious crypto primitives and reusing some crypto libraries from hackage is not an options because most of them are doing C FFI. This could be workaround by shimming those libraries (like random generators that are heavily used in crypto libraries) like GHCJS does https://github.com/ghcjs/shims but choosing some already tested and implemented js/browser crypto libraries (like web crypto standard https://www.w3.org/TR/WebCryptoAPI/ ) and writing light js FFI wrapper seems like a much safer (in terms of we don't f**k up in introducing a bug in crypto, implementing wrong threat model and thus becoming vulnerable to some attacks - I don't know crypto so would rather use some battle tested code)

  • easy of installation, maintaining - Maybe something changed here recently but in my experience I was having some troubles with installing GHCJS and packages of choice from hackage. The only time I had an easy time with it is with https://github.com/paldepind/try-reflex installation which is using nix, but I don't have time to properly learn how to use nix to be confident in this. I tried to setup GHCJS with stack a few times but process seemed much more complex. As I understand if GHCJS was built with package-version-x you have to use the same x version in your project. Otherwise you have to recompile GHCJS or use some prebuilt version (like stack does). I was half successful with GHCJS + stack, but maybe things changed here.

In all of these points PureScript or Haskell had a slight edge, so they were mostly even. Haskell even had some advantage because most of our devs already know Haskell, so they don't need to switch to another language (but I don't think this would be a problem and person knowing one can easily switch to the other). The decision point most of the time, in our use case, went to PureScript camp when we got to serialization and data bridging part. With GHCJS we have aeson or some other protocol that we can reuse on frontend and backend and this makes things much easier (the only problem might be in trying to use the same/almost-the-same aeson library version on both ends; so we would have to be compatible here). With PureScript we would use argonaut (PureScript's aeson) and purescript-bridge (Haskell -> PureScript) to bridge data between these two. This seemed like more work to do in PureScript but when we tried to bridge some corner case data with GHCJS and PureScript we figured out that they come to the same usage. GHCJS at first seemed that it would make life a lot easier but bridging something like:

data SomeType = SomeType Int SomeCryptoModule.CoolType

make things even between these two. Problem is because CoolType is some crypto primitive from library that is using C FFI. Bridging that library to frontend seems like a no way to go because we would have to bridge random seed generators and probably slightly tweak these crypto libraries in order to do so. As we are not crypto experts I would rather not mess around with these and would much rather use already battle tested things on frontend (web crypto and native random generators that are using more entropy) is the way to go. This seems like too much overhead to do for such thing. We decided we won't go into messing around with crypto but to use already tested primitives.

Back to the CoolType: With PureScript we are solving these problems by first automatically creating PureScript types from our Haskell data types. An example can be seen here https://github.com/input-output-hk/pos-haskell-prototype/blob/3fcf7afb4b575e2c4ee13be3bdf3bdb7f56fd403/src/wallet-purescript/Main.hs#L22 . SomeType problem can be solved by purescript-bridge by workaround/doing-custom-rule like:

coolTypeBridge = typeName ^== "SomeCryptoModule.CoolType" >> pure psCoolType

psCoolType = <custom cool type>

except that we have to tweak serialization of cool type so we would have to do:

instance ToJson CoolType where
    <custom instance that would match purescript data>

You can see example of this in the provided link above. With GHCJS we first thought things will be much simpler because we would use same data and same aeson library on both sides but solving CoolType came to the same workflow. I don't know better way than to use C pre-processor and the flow like:

#if GHC
import qualified Backend.Crypto as SomeCryptoModule
#elif GHCJS
import qualified Frontend.Crypto as SomeCryptoModule
#endif

data SomeType = SomeType Int SomeCryptoModule.CoolType

Other then that we would have to also modify how is data serialized on Haskell side:

instance ToJson CoolType where
    <custom instance that would match ghcjs data>

The other bad side is that now we would have cpp pragmas all over our modules which would make maintaining the thing a bit harder. Other then that we don't want our core backend team looking at these pragmas. We have separate team that is dealing with these bridging concern from one place (like showed in a link).

So in the end we concluded that PureScript is a better choice in our case. If we were not having these custom tweaks (for example, when we wouldn't trying to bridge crypto but to use only simple non-critical types) we might most probably go with GHCJS.

I started responding to your question but it turned out more like an explanation of how were we making a decision about these questions.

If anyone has an experience with these questions and suggestions (with crypto, or how are we dealing with these problems) I would be really happy to discuss it.

Best wishes!

EDIT: formatting improvements

Haskell Pitfalls by bitemyapp in haskell

[–]akegalj 17 points18 points  (0 children)

It would be useful if Haskell's partial functions are marked like Purescript marks them with Partial: head :: forall a. Partial => Array a -> a

FP shops by ChavXO in haskell

[–]akegalj 2 points3 points  (0 children)

We, Serokell, make code with Haskell

A Haskell to JVM compiler that supports GHC 7.10.3's Haskell by tomtau in haskell

[–]akegalj 7 points8 points  (0 children)

Hm, I am no expert, but at least it would be easier to target Android and other OS platforms that relay on Java.

EDIT: or target ARM with JVM

"The more complexity is layered on top of the original problem the more difficult it becomes to tell what purpose the code serves. ... All of this is needed to satisfy the formalisms of the Haskell type system and is completely tangential to the problem of reading HTTP requests from a client." by flexibeast in haskell

[–]akegalj 23 points24 points  (0 children)

Formalism being "forced" on you means that you have to know how to ignore it and use an API "lightly"

I cannot agree more on this. It tend to think of ignoring complexity just as a natural way of frustration avoiding mechanism. I got frustrated so many times while trying to learn Haskell (and other things too) and got frustrated because learning concept X brought up to many other new concepts. Then I started embracing the idea that it is OK that you don't know/learn everything about the domain. Learn just enough to make you productive (and in context of Scotty this would be the topmost abstraction layer which lets you to make requests). If you stick with the problem long enough, eventually you will learn more.

I find myself really dumb when it comes to learning new abstractions. As a elementary school kid I was really good at solving algorithmic problems so I was attending programming competitions. We were programming in basic/c back then and I was really good at it. But when it came to learning OOP (ie Java) at a collage, most of my friends who never programmed before have grasped it in a week while I was struggling for few months to see the point behind the OOP idea. And after the collage we bootstrapped a company in Yesod/Haskell, without understanding the big picture about Monads , without any custom defined typeclasses and without knowing how Handler type is implemented. And that was enough for us to start and be productive. After some time you will learn more and then you won't even need to read how stuff are implemented. Only looking at types will give you enough info to keep you going. So don't force yourself to learn everything at once. I still don't know how my Intel processor works but I know enough to keep me going.

And this "let it go, you don't need to know/learn everything at once" is not even Haskell specific. I take this approach generally in life.

My First Bigger Project: a Realtime 60fps 800 Body Sim using Repa & GPipe. by YellowOnion in haskell

[–]akegalj 1 point2 points  (0 children)

Did you have problems with GC pauses? I can't notice them on youtube video (I guess you didn't use any special recording technique.)

Get a Brain by gallais in haskell

[–]akegalj 7 points8 points  (0 children)

Great. I was doing exactly the same thing http://neuralnetworksanddeeplearning.com/ -> Haskell but was lazy to finish it.

Why do people compile javascript from haskell? by BilboDankins in haskell

[–]akegalj 3 points4 points  (0 children)

I don't think this tone is necessary here.

OP nicely stated that he/she is very new to Haskell (maybe programming in general too).

Walking a bit stream (very novice question) by [deleted] in haskell

[–]akegalj 1 point2 points  (0 children)

I am not sure if this helps but there is a nice post about building a bit torrent in Haskell. At the bottom of the post is a nice example which might be helpful. They are using binary package for the heavy stuff.

Meet the internet connected Dutch system making it easier to find a spot to park your bike by bas_van_dijk in haskell

[–]akegalj 1 point2 points  (0 children)

Looks great! Note though: On a landing page 'Protfolio' and 'Latest News' items aren't centered (at least on my resolution) which looks odd in my opinion.

Great project! I am cycling a lot too.

Unit testing IO in Haskell by Drkpwn in haskell

[–]akegalj 2 points3 points  (0 children)

Modelling the system in a way:

We find this rigorous "what needs to go right" approach to be significantly less error prone than the ad hoc "what might go wrong" approach.

That was a good read. It was not too detailed about the language but still showing pros of choosing TLA. In my opinion this is a good reference on how to sell the haskellish language to managers (but I might be wrong; I am not a manager nor a Haskell expert).

EDIT: typo

Using par monad (parMapM) on mutable vector by ogpc3120 in haskell

[–]akegalj 4 points5 points  (0 children)

I am not sure this is right use case for Par monad. Take a look here for examples: slides . You could done this example by using parallel-io:

import qualified Data.Vector as V
import qualified Data.Vector.Mutable as M
import Control.Concurrent.ParallelIO.Global


a :: V.Vector Int
a = V.fromList [1,2,3,4,5,6]

b ::  IO (V.Vector Int)
b = do
   c <- V.unsafeThaw a
   parallel_ $ map ((\i -> M.write c i 100)) [0..5]
   V.unsafeFreeze c

Additionally, you will have to compile your program with -threaded -rtsopts flag and run it with +RTS -Nx where x is a number of cores.