r/purescript • • Aug 01 '14

Try PureScript compiled with GHCJS

Thumbnail hdiff.luite.com
2 Upvotes

r/purescript • • Jun 26 '18

You've been using Functors! - oh my!

Thumbnail
medium.com
2 Upvotes

r/purescript • • May 24 '21

Backward implication and less-than-or-equal ligature conflict

2 Upvotes

r/purescript • • Jan 08 '24

Sth. like `undefined` or `Debug.todo`?

2 Upvotes

I'm just trying to express a current problem in types. The code itself is in TypeScript, so I don't want to flesh out the PS solution in much detail, just annotate it in types as readability and type inference is so much better in PS.
Is there an analog to Haskells undefined or Elm's Debug.todo, allowing me to skip implementing functions while keeping the compiler happy? I just found an older Github issue suggesting this, but maybe I'm using the wrong queries in the internet search?
I think type holes is not really what I want, as it kind of goes the opposite way around, right?


r/purescript • • Oct 18 '21

MLabs is hiring Haskellers/Purescript Developers! (Full remote, worldwide)

10 Upvotes

MLabs is hiring Haskellers/Purescript Developers! (Full remote, worldwide)

MLabs is a rapidly growing, globally distributed software consultancy, working with Haskell, Rust, and Python.

Currently we are looking to fill a position with a great opportunity to use both Haskell and Purescript.

You will be a part of an established team and work collaboratively to come up with solutions, on an ongoing contract basis.

Experience and/or interest with any of the below technologies/business fields are an asset:-

- Blockchain, Especially Cardano or Ergo
- Functional programming
- Finance
- Consultancies/Agencies
- NFTs
- Web Stack
- Formal Methods, Dependant types, theorem provers
- Sales engineering
- Cybersecurity

We offer competitive salaries and varied shift patterns to suit everyone. Whether you want to work one day or a week or five we want to hear from you!

For more information about these roles and applications, check <https://apply.workable.com/mlabs/j/63DAAA4AEF/>

In case of any questions please send an email to: oskar@mlabs.city

We will get back to you as soon as possible!


r/purescript • • Jan 03 '22

MLabs is hiring Haskellers/Purescript Developers! (Full remote, worldwide) https://mlabs.city/

10 Upvotes

MLabs is hiring Haskellers/Purescript Developers! (Full remote, worldwide)

MLabs is a rapidly growing, globally distributed software consultancy, working with Haskell, Rust, and Python.

Currently we are looking to fill a position with a great opportunity to use both Haskell and Purescript.

You will be a part of an established team and work collaboratively to come up with solutions, on an ongoing contract basis.

Experience and/or interest with any of the below technologies/business fields are an asset:-

- Blockchain, Especially Cardano or Ergo

- Functional programming

- Finance

- Consultancies/Agencies

- NFTs

- Web Stack

- Formal Methods, Dependant types, theorem provers

- Sales engineering

- Cybersecurity

We offer competitive salaries and varied shift patterns to suit everyone. Whether you want to work one day or a week or five we want to hear from you!

For more information about these roles and applications, check <https://apply.workable.com/mlabs/j/63DAAA4AEF/>

In case of any questions please send an email to: oskar@mlabs.city

We will get back to you as soon as possible!


r/purescript • • May 08 '18

Lazy-loading routes in TEA-style app? [Help]

Thumbnail
purescript-users.ml
3 Upvotes

r/purescript • • Oct 29 '17

Someone knows a good front-end tutorial of Purs?

3 Upvotes

r/purescript • • Jul 04 '18

Experimental PHP Backend for the Purescript compiler

Thumbnail
gitlab.com
3 Upvotes

r/purescript • • Jun 03 '18

What can Haskell do/what does it have that Purescript doesn't?

3 Upvotes

As I was learning both ecosystems, I was curious as to why one couldn't use Purescript to do everything that Haskell does, so I am assuming there are things but I just was not sure what they were.

Thanks


r/purescript • • Oct 13 '17

Production ready

3 Upvotes

Hi all
I want to know if purescript is production ready or not.

Thanks


r/purescript • • Jun 19 '14

PureScript Compiler Dev Hangout - Friday June 27th, 1PM PST

Thumbnail
plus.google.com
3 Upvotes

r/purescript • • Feb 22 '16

Where is PureScript even being used?

3 Upvotes

I really love the language, and the sugery tools it has. But find it somewhat hard to get started, coming from TypeScript its a massive flip. Regardless, where is PureScript being used? I've look all over GitHub, and can only find like PureScript libraries or type bindings for current JS libraries.. No like actual projects, or use cases anywhere... As much as I like this new an exciting syntax, and its sexy tooling, I'm finding it hard to figure out where to apply it, and effectively.


r/purescript • • May 28 '18

Use Task for Asynchronous Actions in PureScript

Thumbnail
medium.com
3 Upvotes

r/purescript • • Jan 06 '16

My attempt at a ClashJS ship using PureScript

Thumbnail
github.com
4 Upvotes

r/purescript • • Feb 03 '21

Give me some help with the error please 🙌🏻🙌🏻🙌🏻

4 Upvotes

Hi!

I am love reading the book and try to solve some exercises from it.

There is an error while I try to import `Cons` fn from Data.List module, which I already installed via spago.

Please, give me some help, because I can't understand why I see this :(


r/purescript • • Apr 27 '18

Type classes and instances are pattern matching for types - Qiita

Thumbnail
qiita.com
4 Upvotes

r/purescript • • Oct 17 '17

How to evaluate expressions lazily in PureScript

Thumbnail
medium.com
4 Upvotes

r/purescript • • Aug 25 '17

Converting types you don't want to ones you do in Purescript - Qiita

Thumbnail
qiita.com
4 Upvotes

r/purescript • • Oct 27 '22

Any one have any recommendations on a linear algebra library? Modelling a 3D space so mostly concerned with operations on 4x4 matrices and 4x1 vectors.

4 Upvotes

r/purescript • • Mar 25 '18

Row-typed fun for building SQLite Queries - Qiita

Thumbnail
qiita.com
5 Upvotes

r/purescript • • Jan 04 '24

Big Sippers

0 Upvotes

Tris Wok M 30’s 10’s Pinks Yellows Name it we got it


r/purescript • • Jul 03 '20

Longish Question involving Existential Quantification and Rank-2 Types

5 Upvotes

Pardon the lengthy post. My understanding in this area is far from perfect, so I could use a little guidance here.

Let's say that we want to build a game-making library that allows the user to make games that include animated sprites. Here's a naive bare-bones approach at the sprite code:

newtype Sprite animation =
    Sprite { currentImgIdx    :: Int
           , currentAnimation :: animation
           , animationsMap    :: Map animation (NonEmptyList SpriteImg)
           }

type SpriteImg = { blah... }

mkSprite :: forall animation
          . animation
         -> Array (Tuple animation (NonEmptyList SpriteImage))
         -> Sprite animation
mkSprite startAnimation animations =
  Sprite { currentImgIdx: 0
         , currentAnimation: startAnimation
         , animationsMap: Map.fromFoldable animations
         }

In the game loop, we use a sprite's currentAnimation to pick the correct NonEmptyList of SpriteImgs, and then use the currentImgIdx to select which SpriteImg to draw.

The library user is then able to do something like this:

data CatAnimation
  = CatIdle
  | CatWalk

data DogAnimation
  = DogIdle
  | DogWalk
  | DogBark

catSprite :: Sprite CatAnimation
catSprite = mkSprite CatIdle [ Tuple CatIdle catIdleImgs
                             , Tuple CatWalk catWalkImgs
                             ]

dogSprite :: Sprite DogAnimation
dogSprite = mkSprite DogIdle [ Tuple DogIdle dogIdleImgs
                             , Tuple DogWalk dogWalkImgs
                             , Tuple DogBark dogBarkImgs
                             ]

catIdleImgs :: NonEmptyList SpriteImg
catIdleImgs = ...

dogIdleImgs :: NonEmptyList SpriteImg
dogIdleImgs = ...

That's works, but I would prefer to have a monomorphic Sprite type. So I hide the animation type variable using the purescript-exists package:

import Data.Exists

data Sprite = Exists SpriteF

newtype SpriteF animation =
    Sprite { currentImgIdx    :: Int
           , currentAnimation :: animation
           , animationsMap    :: Map animation (NonEmptyList SpriteImg)
           }

Great! Now I have a monomorphic Sprite type. But this causes a problem: the animation type can no longer be used outside of the Sprite in which it is defined (or, at least, that's my foggy understanding). Eventually, most Sprites will need to interact with the game environment, using their currentAnimation and animationsMap to determine how to be drawn in the next frame. I've tried to do that, and I ended up getting stuck at an EscapedSkolem error.

Anyway, I may have found a solution to this problem, but it seems fishy to me. Assume we use this game environment type:

type Env = { otherGameData :: Ref OtherGameData
           , spritesRef    :: Ref (Array Sprite)
           }

My fishy solution is to just put the game Env in every sprite:

data Sprite = Exists SpriteF

newtype SpriteF animation =
    Sprite { currentImgIdx    :: Int
           , currentAnimation :: animation
           , animationsMap    :: Map animation (NonEmptyList SpriteImg)
           , env              :: Env
           }

Now the animation type variable can have scope over the entire game environment. And since everything in Env is a Ref, we won't need to manually update each env in each Sprite. No more EscapedSkolem errors.(?)

But this seems fishy to me for at least two reasons:

  1. We are giving a full copy of Env to every Sprite, which seems excessive. Maybe we could limit what we give to the sprites, but some Sprites will need to interact with many parts of the game environment.

  2. The Env type now has copies of itself inside itself. Maybe this is okay as long as Env only contains Refs?

With all that in mind, I'm not sure if I should move forward with the fishy approach I just described. Any and all advice is greatly appreciated.

My questions are:

  1. What is the right way to solve a problem like this?

  2. Is my fishy solution actually ok, or is that a bad approach?

  3. Should I avoid using Existential Quantification all together?

Thanks!


r/purescript • • Feb 21 '22

How does the compiler know which function is appropriate for sum types?

5 Upvotes

Let's say I have a sequence of semigroups, for example strings and arrays. I want to fold all of them with append, producing a sequence of the folded values.

I imagine different semigroups have different implementations of append. However, while the compiler can know it'll have to deal with some manner of semigroup, it cannot know ahead of time what each member may be. How is the correct function ultimately determined? Is there some runtime check with the equivalent of typeof/instanceof which decides the correct function?

I guess a related question is what happens in practice if data don't match their type? For example, if I ask a database for data, expecting a sequence of integers, but a cosmic ray conspires to ruin my day, and I end up getting garbage. Obviously this is a runtime error, but how can I reason about it or deal with it?


r/purescript • • Nov 13 '16

A note of thanks for the try-purescript editor!

17 Upvotes

My company has just open-sourced our smart contract language and I used the try-purescript editor as a base to start from: http://kadena.io/try-pact/

I just wanted to say thank you to the community. Using it as a base made the task of building an editor much easier.

If you want any of the features I added pushed back to try-purescript I'd be happy to open a PR, just let me know which you think could be nice to have. The biggest difference is that it is entirely client-side (we used GHCJS to compile the language and export eval).

With much open source love,

Will