Skip to content
This repository has been archived by the owner on Sep 7, 2018. It is now read-only.

Pipelines? #83

Open
ggreif opened this issue Dec 1, 2016 · 1 comment
Open

Pipelines? #83

ggreif opened this issue Dec 1, 2016 · 1 comment

Comments

@ggreif
Copy link
Contributor

ggreif commented Dec 1, 2016

I have just written a toy 3-stage pipeline for a moore machine:

pip3 :: (a -> b) -> (b -> c) -> (c -> d) -> (b, c, d) -> a -> (b, c, d)
pip3 f g h (b, c, _) a = (f a, g b, h c)

pmoore = moore (pip3 (*2) show read) project3 (0, "42", 1)
  where project3 (b, c, d) = d

I wonder whether such a thing would be useful for folks. If not, please close. Otherwise I could come up with a pull request. Of course many variants (types of feedback/mealy etc.) would be possible, so some guidance is welcome.

@ra1u
Copy link

ra1u commented Dec 1, 2016

I like idea if it can be extended to generic approach that enables support for wide range of use-cases. I am not sure what function did you aim for, but for pmoore there is also alternative approach that can be useful.

pmoore = r 1 read .  r "42" show . r 0 (*2) 
   where 
         r a f =  register a . fmap f 

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants