Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Proposal for push #104

Open
ghivert opened this issue Jul 13, 2018 · 2 comments
Open

Proposal for push #104

ghivert opened this issue Jul 13, 2018 · 2 comments

Comments

@ghivert
Copy link

ghivert commented Jul 13, 2018

Hi.

I'm often using something like

pushIn : List a -> a -> List a
pushIn list elem =
  elem :: list

to use it into pipelines

doSomethingWithElems : a -> List a -> List a
doSomethingWithElems myElem allMyElems =
  myElem
    |> doSomethingWithTheElem
    |> pushIn allMyElems

What do you think about it?
It's the exact reverse of (::), but since flip is gone, I think it is worthwhile.

@pzp1997
Copy link
Contributor

pzp1997 commented Jul 13, 2018

I would personally prefer |> \elem -> elem :: allMyElems here. Just my two cents.

@Chadtech
Copy link
Collaborator

I dont think its really that useful. In these cases I do..

doSomethingWithElems : a -> List a -> List a
doSomethingWithElems myElem =
    (::) (dosomethingWithTheElem myElem)

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

No branches or pull requests

3 participants