608 questions
Score of 2
1 answer
57 views
Why eta-reduced of genericShow-based show definition overflows stack for recursive types
Consider the following recursive data type:
data Chain a = End | Link a (Chain a)
By deriving a Generic instance for this recursive type, show can be defined in terms of genericShow:
derive instance ...
Score of 1
1 answer
143 views
Confused about do notation
I'm barely getting started with Purescript, and I hit a snag quite quickly. Consider the simple (and very artificial) example below:
module Main where
import Prelude
import Data.String.Common (...
Score of 1
1 answer
60 views
Handling complex JSON with enums and variable sub-JSON schemas
I have a complex JSON which can have variable sub-JSONs inside it, each with their own schema. Here is an illustration of its structure:
[
"node_level": "unit",
"name"...
Score of 0
1 answer
268 views
Spago failing to install PureScript dependencies due to Git error: 'destination path . already exists and is not an empty directory' on NixOS
I'm trying to get a hello-world Purescript project working on NixOS, and am encountering an error trying to get spago to build it. The installation of dependencies fails with the following error:
[...
Score of 0
1 answer
59 views
Adding missing "method" attribute in Purescript-Halogen
Apparently, Halogen lacks "dialog" value of method attribute. As of writing the words, the method attribute in Halogen has only get and post values.
The good news though is Halogen says that ...
Score of 2
2 answers
242 views
How to make build system produce multiple js outputs?
This would seem like a basic question, but I found no information on it. Websites don't typically consist of a single page. E.g. Stack Overflow has a menu on the left with Home, Questions, Tags links, ...
Score of 0
2 answers
81 views
PureScript: how to wait for child to exit?
I'm writing a backend, and I need to execute certain command with text passed via stdin, then read the result from stdout. Such utilities provided by Node.ChildProcess module, except I don't see any ...
Score of 1
1 answer
60 views
How to make different record `type`s unequal
I am learning PureScript due to not being satisfied (in particular) with TypeScript's type safety of what's called "records" in PS. While doing so I stumble upon the exact same problem in PS,...
Score of 2
1 answer
282 views
Error installing spago@next using npm on node:22 Docker image
I am trying to set up a Docker development environment with PureScript. While trying to install Spago I get an error from the Docker builder. I am using the "node:22" image as a starting ...
Score of 3
3 answers
350 views
What does "parameterised type in the positive / negative position" mean in the context of invariant functors?
From PureScript's Data.Functor.Invariant documentation (emphasis mine):
A type of functor that can be used to adapt the type of a wrapped function where the parameterised type occurs in both the ...
Score of 7
0 answers
196 views
Where does the name of the `pure` function in the `Applicative` type class come from?
At this point in my learning journey, I simply accepted that this function is called pure (both in Haskell and in PureScript), but it would have helped a lot if I had known the reasoning behind this ...
Score of 1
1 answer
86 views
Why is the `Data.Int` type not a `Semigroup` in PureScript but `String` is?
> "lo" <> "fa"
"lofa"
> 1 <> 2
Error found:
in module $PSCI
at :1:1 - 1:7 (line 1, column 1 - line 1, column 7)
No type class instance was found for
...
Score of 1
0 answers
127 views
Why can't I use a row-polymorphic variable?
Take a look at this PureScript code:
type MyOtherProps = (value :: String)
type MyProps = (a :: String)
a
:: forall props phantom allProps
. Union MyProps MyOtherProps allProps
=> Union ...
Score of 1
1 answer
334 views
Is there a way to integrate PureScript and Vite together?
I use spago to build src/Main.purs to output/Main/index.js.
I am trying to use Vite for the bundling tool and have successfully loaded output/Main/index.js in src/main.ts.
Vite can import image files, ...
Score of 2
1 answer
151 views
Is `Pair` a valid instance of `MonadRec`?
In the paper Stack Safety for Free, Phil Freeman defines the MonadRec type class as follows.
class (Monad m) <= MonadRec m where
tailRecM :: forall a b. (a -> m (Either a b)) -> a -> m b
...