How to use 'id' from REPL?

I apologize for this question, but this most basic thing just is not working for me in the REPL. I am attempting to use the ‘id’ function from Control.Category, or if you prefer, the ‘id’ function from Data.Function, which claims to be an export also from Prelude, also imported into the REPL. Every time:
Unknown value id

A tangible example:

Just 5
# map (_ + 10) -- cool stuff
# maybe 50 id


In Purescript, that function is called identity :

PSCi, version 0.13.6
Type :? for help

import Prelude

> :type identity
forall t a. Category a => a t t

1 Like

Wow. This page literally says the exact opposite:

Thank you, so much!

Also, the docs here say the opposite:

I was burned by this two months ago. PR pending:

1 Like

You are looking at an old version of Prelude docs. It was renamed to identity with the 4.0 release of Prelude to free up id, since it’s a common identifier with real-world code.

1 Like

In general, this has been a problem with literally everything I’ve touched in PureScript: Outdated docs, outdated projects, outdated build tools, abandoned projects that it’s unclear if anyone should be trying to use them or if it’s just going to cause problems. I don’t know what happened, as I’m new to PureScript, but it’s been tough getting started when all of these effects are combined.

Yes, PureScript is a young language which has evolved a lot in the few years it’s been used in anger.

1 Like


This works nicely now:

… Just 5
… # map (_ + 10)
… # maybe 50 identity


The docs are up-to-date though, see We keep older versions of docs around because people might still be using the older versions.

1 Like

I understand. Maybe there shouldn’t be a way to link directly to the older versions of the docs. That’s pretty much exactly what happened that caused my confusion. I really did try to read the docs before I posted this question. If you clicked through the link and didn’t check the drop-down (that was at the top of the page, out of sight), there wasn’t any notice that you were looking at old docs.

1 Like

I’ve also had issues by not reading the dropdown version, but I think it’s still good to be able to link to old docs.

Some options that could alleviate confusion in the future are:

  1. Remove the version tag from the docs URLs when browsing the latest version. These links already work.
  2. Replace the version with “latest”. These links are not yet supported:

That should make it more obvious when APIs change.

But if it’s latest/Control/..., what happens if the module is renamed? Wouldn’t the link break?

Yes it would, but you’d still be able to search for the old module, and specify a particular version if you really wanted to.

I think it’s best to break links to out-of-date modules if attempting to point to the latest.

The problem isn’t so much that the docs are out-of-date. The problem is that the docs you are initially told to use to learn PureScript are out-of-date. Moreover, they don’t tell you tips like removing the library version from the Pursuit link or things like that. I experienced the same problem and that’s why I wrote my learning repo here:

There are various reasons for why the docs aren’t fully up-to-date yet, but we’re not going to play the blame game or explain history. Rather, the good news is that these official docs are being updated. @milesfrain has been doing some great work! And even in that process, the community as a whole tries to respond quickly to questions (and frustrations) that new learners have while we deal with this issue.


How about big yellow banner “You’re reading the docs for version 4.1.0, but the latest version is 4.1.1” (or similar)?

1 Like

I would be up for adding some kind of warning banner but I think it shouldn’t be too obtrusive - as I say, people often have good reasons for reading older versions of docs, because in lots of cases it doesn’t make sense to always be right up on the bleeding edge of everything. I quite like how Rust does it, eg

1 Like

That might not solve the original issue, where a link takes you to lower down on the page beyond the banner.

What about using a different background hue for latest versus non-latest, along with a rust-doc-style warning?

I would prefer to address that by using fixed positioning for the header. That has additional benefits: e.g. easy access to the search bar regardless of how far you have scrolled down.


I think the fixed position header is better, especially to avoid banner blindness too.

I have no idea if it’s possible to fix, but I have mostly experienced finding old docs when I google something and the first result is almost never the latest version. Try googling “Data.Functor purescript” and the top result is the oldest version of the docs available.