Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
48 views

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 ...
jfMR's user avatar
  • 25.2k
1 vote
1 answer
107 views

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 (...
SolarBear's user avatar
  • 4,617
1 vote
1 answer
57 views

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"...
stasp's user avatar
  • 70
0 votes
1 answer
249 views

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: [...
mherzl's user avatar
  • 6,320
0 votes
1 answer
52 views

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 ...
Hi-Angel's user avatar
  • 5,865
1 vote
2 answers
199 views

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, ...
Hi-Angel's user avatar
  • 5,865
0 votes
2 answers
79 views

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 ...
Hi-Angel's user avatar
  • 5,865
1 vote
1 answer
54 views

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,...
Hi-Angel's user avatar
  • 5,865
2 votes
1 answer
265 views

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 ...
John F. Miller's user avatar
2 votes
2 answers
258 views

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 ...
toraritte's user avatar
  • 8,725
7 votes
0 answers
168 views

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 ...
toraritte's user avatar
  • 8,725
1 vote
1 answer
67 views

> "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 ...
toraritte's user avatar
  • 8,725
1 vote
0 answers
89 views

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 ...
Jose Quesada's user avatar
1 vote
1 answer
279 views

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, ...
topica's user avatar
  • 329
2 votes
1 answer
129 views

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 ...
Aadit M Shah's user avatar
  • 74.5k
6 votes
2 answers
223 views

In real world application I noticed a pattern that could be generalized to something like: purescript: class Profunctor p <= Zero p where pzero :: forall a b. p a b -- such that `forall f g. ...
Eryk Ciepiela's user avatar
1 vote
0 answers
100 views

When I run spago docs, the documentation is generated for every dependencies in my project. Is it possible to generate a documentation only for project files? So only for .purs files in src. I am ...
christian wuensche's user avatar
1 vote
2 answers
85 views

The following code, being executed in Chrome, fails after printing 7492: module Main where import Prelude import Effect (Effect) import Effect.Console as Console import Data.Array as Array import ...
Mikhail Brinchuk's user avatar
1 vote
1 answer
124 views

I'm trying to remove an element from an Array a using the index of the element but I can't find a way to do it with Lenses. I'm also wondering why Array does not provide an instance for the At lens. ...
amaille's user avatar
  • 65
0 votes
2 answers
157 views

Is it possible to build a vscode extension from a javascript transpiler ? For example, is it possible to build an extension with "js of ocaml" or purescript. Those transpilers compiles to ...
user2187032's user avatar
4 votes
4 answers
287 views

Today I encountered an implementation challenge with a large DU (sum-type) in F#, where I basically wanted to be able to map a set of functions over the values of the DU without having to repeat the ...
user avatar
0 votes
0 answers
70 views

I have a SVG image like the following: It is a simple SVG with a number in it. The SVG file looks something like this: <svg ...> <g ...> <text id="my_text" ...> ...
cdupont's user avatar
  • 1,198
0 votes
1 answer
43 views

I solve Purescript exercise from the book https://book.purescript.org/chapter6.html#multi-parameter-type-classes I don't understand what "zero" statement is? I have "Complex" type, ...
Andrey Dolmatov's user avatar
1 vote
1 answer
113 views

How do I get the the browser URL in Purescript, just like when doing window.location.href in javascript?
Chris Stryczynski's user avatar
3 votes
1 answer
135 views

What is () defined as? I see it in type signatures, I thought it was the unit type same as in Haskell but it seems instead Purescript uses Unit. So then what is ()? Using spago repl was not helpful ...
Chris Stryczynski's user avatar
3 votes
1 answer
88 views

Consider my two attempts at writing the same function: data Foo = Bar Int | Quux Int | Baz Int f :: Foo -> Int f (Bar n) = n f other = case other of Quux n -> 2 * n Baz n -> 3 * n ...
Brennan Vincent's user avatar
0 votes
0 answers
39 views

Is there any way I can add a constraint to a type class function dynamically? Let's say my type class takes a function of type type FieldTraverseFn :: Row Type -> (Type -> Type) -> Type type ...
Saravanan's user avatar
  • 951
1 vote
1 answer
73 views

I have a newtype which takes a parameterized type, newtype MockState m = MockState { apiState :: {api1 :: m Int, api2:: m String} } derive instance newtypeMockState :: Newtype (MockState m) _ I have a ...
Saravanan's user avatar
  • 951
0 votes
1 answer
53 views

I want to persist some data in StateT monad, Within Handler of the post(any http method) function I want to modify the data stored in state... but the issue is I can't use State inside Handler... ...
Saravanan's user avatar
  • 951
0 votes
1 answer
100 views

I'm trying to do something similar to what Partial type class does, so to understand Partial constraint better I started experimenting with it... I created a normal function, goodFn :: Int -> ...
Saravanan's user avatar
  • 951
0 votes
1 answer
82 views

I want to create a function, that takes function as varying argument, the only thing i know about the funtion argument(which is a function itself) is they are wrapped in the same Monad.... myFunc :: ...
Saravanan's user avatar
  • 951
2 votes
0 answers
50 views

Coming from Haskell, I'm accustomed to using it to refer to the result of the previous command in GHCi: ghci> 1+1 2 ghci> :type it it :: Num a => a ghci> it*2 4 I went looking to see if ...
Alex's user avatar
  • 41
3 votes
0 answers
150 views

For explaining this issue. I have created a sample project. I am using purescript. I am doing a dynamic import and webpack is generating 2 bundles. If I comment the dynamic import and use a static ...
Avinash Verma's user avatar
0 votes
1 answer
53 views

While doing exercises of chapter 3 of the Purescript by Example book was puzzled by this: The exercise is to write an isInBook :: String -> String -> AddressBook -> Boolean findEntryByName :: ...
Chris Wesseling's user avatar
0 votes
1 answer
106 views

I am new to Purescript so I was trying to implement fold left and fold right (aka reduce) for my custom Tree data structure, but I am having problem implementing logic for fold right: data Tree a = ...
Djordje Vuckovic's user avatar
0 votes
1 answer
95 views

I am new to PureScript so I am re-creating some basic functions, and I wanted to recreate "takeEnd" function which takes specified number of elements from the end of the list. Here is ...
Djordje Vuckovic's user avatar
0 votes
1 answer
137 views

I'm quite new to Purescript and I am trying to process some user input (received from stdin) but my best approach is this one: processInput :: String -> Effect Unit processInput input = do let ...
Alex's user avatar
  • 3
1 vote
2 answers
116 views

I'm a newbie in PureScript now reading a book "Functional Programming Made Easier: A Step-by-Step Guide", but when I got to the section on Tuples, I realised that all that was presented ...
maxloo's user avatar
  • 491
2 votes
1 answer
125 views

Can someone tell me what is the use case of purescript-variants or variants in general The documentation is very well written but I can't find any real use case scenario for it. Can someone tell how ...
Saravanan M's user avatar
0 votes
2 answers
212 views

I'm a newbie at PureScript trying out some code at this link. I've pasted the code here: module Main where import Prelude import Data.Foldable (fold) import Data.Tuple import Data.Map as Map import ...
maxloo's user avatar
  • 491
1 vote
1 answer
121 views

I have a utility function to conditinally render elements: thanRender :: ∀ w i. Boolean -> EL.HTML w i -> EL.HTML w i thanRender true h = h thanRender _ _ = EL.text "" Usage: ...
christian wuensche's user avatar
0 votes
2 answers
114 views

I got the following data type: data Icon = IconCircle | IconSquare | IconStar I need an array of all possible Icons?: allPossible :: Array Icon allPossible = [IconCircle, IconSquare, IconStar] Is ...
christian wuensche's user avatar
0 votes
0 answers
134 views

TLDR: Is there a type system which allows we to express a type (constraint/interface) I = NoField<'a'>, such that for all type T, if T <: I, then T is a struct and does not have a specific ...
xiang0x48's user avatar
  • 681
0 votes
1 answer
180 views

Can I always replace a do-block like this: do ... pure ... where the last line is "pure" something, with an ado-block like this: ado ... in ... ? I know do only requires Bind and ...
Drathier's user avatar
  • 14.7k
1 vote
1 answer
138 views

I'm learning Halogen at the moment but I have a hard time finding how to chain actions. Let's say I have a simple article list component. I also have an "add" button to create a new article ...
amaille's user avatar
  • 65
0 votes
1 answer
67 views

I want to colorize my string with ASCII colors, but the following code... data Color = White | Red | Green | Yellow colorizeWith :: Color -> String -> String colorizeWith Green s = "\031[...
Max Smirnov's user avatar
0 votes
0 answers
82 views

I'm trying to use a combination of purescript-pipes, and purescript-pipes-aff to write a version of await which will return Nothing if it doesn't receive a value in a specified amount of time. So far, ...
Joe's user avatar
  • 1,619
0 votes
1 answer
69 views

import Prelude data Line = Front | Middle | Back derive instance eqLine :: Eq Line instance ordLine :: Ord Line where compare a b | a == b = EQ compare Front _ = LT compare Back _ = GT ...
Robb's user avatar
  • 67
0 votes
0 answers
36 views

I have this function that returns listScheduledPhotos :: ListScheduledPhotosOptions -> ExceptT Error Aff S3ObjectCollection listScheduledPhotos = resolvePromiseOrThrow <<< ...
Ahmed's user avatar
  • 21
1 vote
2 answers
246 views

as title says, I want to know about how to get stdin using Purescript. I want to input string using my keyboard. that's all. in fact, I can find some code just googling this. but nothing runs corretly....
LKB's user avatar
  • 523

1
2 3 4 5
13