the Strict language extension*
Add a new language extension -XStrict
which turns all bindings strict
as if the programmer had written a !
before it. This also upgrades
ordinary Haskell to allow recursive and polymorphic strict bindings.
https://github.com/ghc/ghc/commit/46a03fbec6a02761db079d1746532565f34c340f
Все теперь можно думать о том, чтобы учить хаскель. // Ну или Ocaml
Кстати, спалите haskell vs ocaml в вопросах:
* C-FFI
* многопоточности
* ease of deployment
* поддержки ARM
* легкости получения soft realtime
Олсо, кто-нить объекты в Ocaml юзает или это шутка?
Наткнулся на такой комент на HN:
/However, with a few minor tweaks (e.g. an option type), I would rather have the C# type inference than the OCaml one. The reason is that, if I want to do something very clever, I will not find myself limited to code that I can actually prove to the OCaml compiler as correct: I have, time and time again, resorted to reflection and code generation to work around such situations. In other words C#'s Obj.magic is a lot more powerful (and safe, and expressive) than OCaml's.
A fairly good example is Eliom's way of expressing the parameters of a service. In C# you would write in a PageController class
public Details Update(PageId id, UserId user, [PostBody] Details body)
and have your web framework automatically bind this to POST /page/update/{id}?user={user} with the appropriate serialization for PageId and UserId. And writing such a framework is easy: a couple hundred lines of code, with run-time type safety.
In OCaml you have to understand the entire Eliom_parameter framework: https://ocsigen.org/eliom/4.2/api/server/Eliom_parameter Just think of the mental firepower needed to create that framework in the first place!/
Вот скажите, в хаскеле же есть средства против DRY?
Я практически не знаю хаскель, учил только Standart ML слегка. Решил почитать исходники GHC. Как это понимать https://github.com/ghc/ghc/blob/master/compiler/codeGen/CgUtils.hs#L27 https://github.com/ghc/ghc/blob/master/compiler/codeGen/StgCmmArgRep.hs#L120 ? Это что, нельзя сделать короче? Или это сгенерированные исходники?
Prelude> :l /tmp/a.hs
[1 of 1] Compiling Main ( /tmp/a.hs, interpreted )
Ok, modules loaded: Main.
*Main> :trace c
"Stopped at <exception thrown>
_exception :: e = _
[<exception thrown>] *Main> :back
Logged breakpoint at /tmp/a.hs:1:5-11
_result :: [a]
[-1: /tmp/a.hs:1:5-11] *Main> :l
Ok, modules loaded: none.
Prelude> :hist
Not stopped at a breakpoint