Questions tagged [transducer-machines]

Machines are a framework for describing I/O in a functional setting. Compared to pipes and conduits, they offer more flexible input.

Machines are a functional programming concept that is an alternative to pipe libraries such as "pipes" and "conduit". Some of its advantages includes more flexible input, allowing for example one component to read multiple inputs in various ways.

The machines package provides a Haskell implementation.

12 questions
48
votes
1 answer

Using Scalaz Stream for parsing task (replacing Scalaz Iteratees)

Introduction I use Scalaz 7's iteratees in a number of projects, primarily for processing large-ish files. I'd like to start switching to Scalaz streams, which are designed to replace the iteratee package (which frankly is missing a lot of pieces…
Travis Brown
  • 135,682
  • 12
  • 352
  • 654
28
votes
1 answer

What's the conceptual difference between Machines and Conduits (or other similar libraries)?

I'd like to learn the concept, so that I'd be able to understand and use libraries such as machines. I tried to follow Rúnar Bjarnason's talk on machines, but there is too little information, basically just a bunch of data types. I can't even…
Petr
  • 60,177
  • 8
  • 136
  • 295
8
votes
2 answers

What are the similarities and differences between Scala Transducers and Clojure Transducers?

Paul Chiusano and Rúnar Óli have written a fantastic book Functional programming in Scala. In it they mention a little-referenced concept in the Scala community - Transducers. In the Clojure Community - Transducers get a little more press. My…
hawkeye
  • 31,052
  • 27
  • 133
  • 271
4
votes
1 answer

Using Data.Machine, how can you compose two ProcessT together that modifies two different states?

Let's say I have a process that modifies an underlying state that is an Int: p1 :: ProcessT (State Int) Int Int p1 = repeatedly $ do a <- await lift . modify $ (+a) yield a And another that modifies an underlying state that is an [Int]: p2…
xiaolingxiao
  • 4,340
  • 3
  • 27
  • 64
3
votes
1 answer

Using Data.Machine, how would you describe a plan that branches with results of a non-deterministic function?

I think this question is best illustrated with an example. A type that wraps a non-deterministic function: data ND a b = N { runN :: a -> [(b, ND a b)] } instance Show (ND a b) where show n = show "" An example of ND: nd :: ND String…
xiaolingxiao
  • 4,340
  • 3
  • 27
  • 64
3
votes
1 answer

Could someone provide a machines implementation of the following plan?

I am playing around with the machines module by Edward Kmett, and I'm getting a little confused here and there. I thought the best way to ask a question is to provide a toy use case. Described below. Machines one and two sit at two prongs of a…
xiaolingxiao
  • 4,340
  • 3
  • 27
  • 64
2
votes
2 answers

Constructing a Moore Machine

I have a homework question: Construct a Moore machine that takes a string consisting of a's b's and c's as input and outputs a string containing 1 at the end of each substring abc and a 0 in all other positions. e.g. input, aabcb produces…
1
vote
0 answers

Issues with Foma fst when using python

I am trying to morph analyse a full folder containing txt files. using https://code.google.com/archive/p/foma/ This is the code which i have written.I am passing each word to the foma fst in python but after running for 143 files out of 1900 files…
gaurus
  • 426
  • 4
  • 14
0
votes
0 answers

Transducing reversibly with FSMs

First,i would like to confirm the number of FSM an we create with n states and p input symbol and o output symbol (transition function). can we estimate the percentage of invertible FSMs of all this FSMs. Regards
0
votes
0 answers

Difference between non-deterministic input transducer and observable transducer

What is the similiriies and differences between a non-deterministic on input transition transducer and an observable transducer.
0
votes
0 answers

How to parse a tree in automaton?

I'm try to learn about trees automaton and transduction, i have question for example i want to implement an automaton that can read on input a tree and accept or reject (python). thanks
0
votes
0 answers

Is there a more efficient way to look for a equivalent state? (Finite state transducer)

I am trying to implement the minimal finite state transducer described by Mihov and Maurel (http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.24.3698) in Python3. My program is working but needs a lot of time, so I decided to use cProfile to…