608 questions
1
vote
1
answer
50
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 ...
1
vote
1
answer
118
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 (...
1
vote
1
answer
57
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"...
0
votes
1
answer
253
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:
[...
0
votes
1
answer
52
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 ...
1
vote
2
answers
207
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, ...
0
votes
2
answers
79
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 ...
1
vote
1
answer
57
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,...
2
votes
1
answer
267
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 ...
2
votes
2
answers
266
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 ...
7
votes
0
answers
172
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 ...
1
vote
1
answer
73
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
...
1
vote
0
answers
90
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 ...
1
vote
1
answer
286
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, ...
2
votes
1
answer
137
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
...