- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我认为埋头于所列语言的源代码对我来说太过分了。但是有没有人能够简单地解释一下事情是如何发生的?
我的意思是,最终不可变数据仍将是 javascript 的数据。或者编译后的代码是否包含非标准数据结构,例如'a,b,c' 不可变数组的字符串
最佳答案
我会回答有关 PureScript 的问题,因为我对这种语言比较熟悉。
来自 PureScript By Example [2.7]关于 PureScript 到 JavaScript 的生成:
- Every module gets turned into an object, created by a wrapper function, which contains the module’s exported members.
- PureScript tries to preserve the names of variables wherever possible.
- Function applications in PureScript get turned into function applications in JavaScript.
- The main method is run after all modules have been defined, and is generated as a simple method call with no arguments.
- PureScript code does not rely on any runtime libraries. All of the code that is generated by the compiler originated in a PureScript module somewhere which your code depended on.
These points are important, since they mean that PureScript generates simple, understandable code. In fact, the code generation process in general is quite a shallow transformation. It takes relatively little understanding of the language to predict what JavaScript code will be generated for a particular input.
因此,是的,正如您所写:“最终,不可变数据仍将是 javascript 的数据”。编译后,PureScript 模块的包装函数在更高级别保证了不变性。
关于immutability - ClojureScript、Elm、PureScript、GHCJS 等不可变语言如何编译为可变 javascript?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52087693/
我通过堆栈安装了 GHC(以便 stack ghc -- --version 显示 GHC-7.10.3 ) $ stack install ghcjs Run from outside a proj
我正在使用 nix 和 reflex 平台将 haskell 编译为带有 GHCJS 8.0.1 的 javascript。我编写了一些依赖于 text 库中的内部模块的函数:Data.Text.In
我对 Haskell 和 ghcjs 还很陌生。我从第一个“Hello, world!”开始。程序学习。 这是我的 Haskell 程序,从 GHCJS wiki 复制而来: module Main
如果有人使用 setInterval通过 Javascript,还是使用基于线程的更惯用的解决方案? 最佳答案 使用 setInterval构成 some challenges Alexander、E
如果是这样,那么我可以让人们通过更改其(Haskell)配置来玩弄我的项目:在浏览器中重新编译它,然后在浏览器中重新运行它。我不在乎速度。我只想能够在浏览器中演示一个难以设置的桌面项目。因此,可能的新
我正在尝试了解如何使用 GHCJS-DOM 创建 GUI。我一直在看 hello world 示例 https://github.com/ghcjs/ghcjs-dom-hello ,这是微不足道的。
我正在测试我自己的 ghcjs 补丁,我想知道如何将其打包以与堆栈的字段一起使用,这似乎需要类似的内容: setup-info: ghcjs: source: ghcjs-0.
HTML5 引入了标准文件 API。 GHCJS 是否允许访问该内容?我可以在 System.IO 中使用标准 Haskell IO 工具吗? 最佳答案 我认为不可能使用 HTML5 文件 API 来
我如何在 GHCJS 中进行多行国外导入?我有一个跨越多行的 javascript block : foreign import javascript unsafe "{ var x = 41;\
我正在开发一个 Haskell 应用程序,该应用程序在使用 GHCJS 编译的浏览器中运行,该应用程序通过 websockets 与同样用 Haskell 编写的服务器通信。两个程序共享相同的 Has
堆栈文档提供了使用 ghcjs 进行编译的示例配置 https://docs.haskellstack.org/en/stable/ghcjs/ 。但最新的例子是 lts-7.19。我想配置堆栈以使用
我尝试使用 cabal install 安装 reflex 和 reflex-dom 我收到以下错误消息: $ cabal install reflex-dom ... cabal: The foll
使用 Haskell Stack 初始化 GHCJS 项目需要做什么? 遵循stack documentation我正在尝试初始化 GHCJS 项目,以便可以将 Haskell 代码编译为 JavaS
我想知道目前是否可以用 Haskell 编写游戏 Helm或者通过 GHCJS 在浏览器上运行的任何其他引擎? 最佳答案 这是Pong在榆树。 并不是一个完整的游戏,但是 一个turtle swimm
此时GHCJS编译失败postgresql-simple包(参见 [ 1 ])。我想用 persistent包生成数据库模型。我想知道是否可以使用 GHC 本身编译模型并在 GHCJS 源代码中重用由
我正在尝试移植 haskell 库 minisat使用 ghcjs 到 JavaScript,以便集成到更大的 haskell-ghcjs 项目中。 minisat 包含几个从 c 库导入的 ffi。
我正在尝试使用 node.js 运行一个使用 GHCJS 构建的程序。但是,我收到以下错误: SyntaxError: Too many variables declared (only 131071
我认为埋头于所列语言的源代码对我来说太过分了。但是有没有人能够简单地解释一下事情是如何发生的? 我的意思是,最终不可变数据仍将是 javascript 的数据。或者编译后的代码是否包含非标准数据结构,
如何在 GHCJS 中导入如下 Javascript 函数? xs.subscribe(function(x) { console.log(x) }) 我尝试了以下各种组合但没有成功: data Ob
我正在尝试在 Mac OSX 上安装 ghcjs-dom 包。由于存在很多依赖关系,因此一直很坎坷。 Webkitgtk3 是我目前的克星 cabal install ghcjs-dom Resolv
我是一名优秀的程序员,十分优秀!