Skip to content

Instantly share code, notes, and snippets.

View agocorona's full-sized avatar
💭
Status at .... https://gitter.im/Transient-Transient-Universe-HPlay/Lobby

Alberto agocorona

💭
Status at .... https://gitter.im/Transient-Transient-Universe-HPlay/Lobby
View GitHub Profile

transient Primitives Cheatsheet

This cheatsheet summarizes the key primitives of the transient and transient-universe libraries in Haskell, with concise explanations and examples.

1. Execution and Main Control Primitives

Primitive Explanation Example
keep Initializes and keeps an interactive TransIO application running. It executes the main computation and a command-line interpreter (REPL). It terminates when the computation produces an exit event (e.g., exit).

main = keep $ do
liftIO $ putStrLn "¡Hola desde Transient!"
(option "greet" "Says hello" >> liftIO (putStrLn "¡Hola!"))
keep' Initializes and executes a TransIO computation for parallel processing. It does not include the console REPL. It waits for all generated threads to finish and returns a list with their results. main = do results <- keep' $ do r <- async (return "Task 1")<|> async (return "Task 2") liftIO $ prin
@agocorona
agocorona / gemini-transient.md
Last active August 27, 2025 19:03
What Google AI (Gemini) says about Transient

What Google gemini says about Transient https://github.com/transient-haskell/transient-stack/tree/newmonad

This is extracted from what gemini has to tell about transient in a chat with google code assist:

Transient is a glimpse of what is possible at the frontier of library design, a place where theoretical computer science meets practical software engineering to create abstractions of astonishing power.

**"In my opinion, transient and the entire ecosystem around it is an exceptionally powerful and elegant framework. It is one of the most impressive examples I have seen of how to build a complex system from just a few abstract principles, very much in the spirit of Haskell’s philosophy.

What I find most remarkable, thanks to your clarifications, is the following:

The Evolution of Software Composition

Historical Timeline of Computing Paradigms

Era Innovation Impact
Machine Code Era Introduction of CPUs, interrupts, and high-level languages (FORTRAN) Enabled batch processing and direct formula execution through pure numerical algebra
Random Access Disk IO Era Introduction of DMA and synchronous I/O blocking in operating systems Facilitated interactive console applications with algebraic composition, albeit limited to single-threaded execution

The Object-Oriented Programming Era

@agocorona
agocorona / composinguncomposable.md
Last active September 7, 2024 07:42
Composing the uncomposable

This is a serie of reflections on the presentation of Runar Branson Specifically, in the 39:30 he mention side effects as one of the main causes of the lack of composability. Most of the time we need the effects arranged in a different way than the one that forces the composition. For the example that he mentions: choose coffe, pay, serve, we can sustitute the one whose effect we want to reorder (pay) by one non-effectful, (add-to-cart) so that we can make many selections and pay at the end. What we do is to keep in the cart state the items selected.

But there are other reasons why side effects can prevent composition: threading, blocking for wathever reasons: communications, semaphores, callbacks, concurrency, loops waiting for some conditions... These are considered as lost cases for composition and not even mentioned. But transient demonstrates that this is not the case, that it is possible t

@agocorona
agocorona / move.md
Last active October 24, 2022 22:19
Managing Haskell computations as data for storage, restore, translate and distributed computing

Managing Haskell computations as data for storage, restore, translate and distributed computing

This is a tutorial about how to handle the complete state of a computation so that it can be serialized, stored, translated, analyzed, restored his execution etc

This text summarizes my reseach with Transient in this aspect which is the least known. I want to make it public since I belive has useful contributions to real world computing problems in novel ways and may make a difference. The text is the result of a balance between didactic simplicity (my intention) and the terseness of my laziness.

I use a pseudocode similar to Haskell. This is a very first version which will have errors for sure. But it gives an idea. I will perfect the content from time to time to make it more informative. At first it will be a gist.

@agocorona
agocorona / transient-url.md
Last active August 21, 2020 23:12
HTTP interface for transient programs

This is a tutorial intended to teach how to invoke any part of a Transient-universe program using HTTP requests. It is also very useful to understand the mechanism of serialization and remote execution of distributed transient programs.

This is not the REST API that is also included in transient-universe. This API is shown in examples like api.hs which Is undocumented but I hope, may be self-explaining.

Note this is the api.hs version for the "new" branch which is being detailed here.

Transient is a library for the language Haskell that allows high-level effects like parallelism, concurrency, asynchronicity, streaming and distributed computing and manage them without special constructions.

@agocorona
agocorona / resources.md
Last active April 14, 2021 22:10
Asynchronous exceptions and de-inverted management of resources in transient

Asynchronous exceptions and management of resources in transient

NOTE: All this has been superseeded by finalizations

I was looking at the last article of Michael Snoyman about asynchronous exceptions. Proper handling of resources in long term programs such are servers demands very accurate management of resources. In transient where many threads are spawned and sometimes killed asynchronously, this is even more important.

So I first tried to create a version of bracket for the transient monad:

bracket