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

Provide an abstract/unabstract refactoring #1197

Open
jakub-nlx opened this issue Apr 4, 2024 · 0 comments
Open

Provide an abstract/unabstract refactoring #1197

jakub-nlx opened this issue Apr 4, 2024 · 0 comments

Comments

@jakub-nlx
Copy link

Add the following two refactorings:

Abstract

viewButton active config_ =
     Button.button
            [ Button.onClick
                (config_.tagger
                    (ToggleResponsiveMenu
                        (if active then
                            DefaultState

                         else
                            QuickFilters
                        )
                    )
                )

running Abstract while selecting lines 5-11 :

viewButton active config_ =
     Button.button
            [ Button.onClick
                (config_.tagger (myFunction active))

 $0myFunction $1active =
      (ToggleResponsiveMenu
                 (if active then
                       DefaultState

                  else
                       QuickFilters
                  )
        )

with tabstops indicated by $0, $1.

Should work at the type level:

type Foo
   = Foo { val : Int, name : String }
   | Bar Int

Activating while selecting the record:

type Foo
   = Foo MyRecod
   | Bar Int

type alias $0MyRecord = 
    { val : Int, name : String }

Un-abstract is conceptually the reverse:

type alias Strings = List String

myFun : Strings -> String 
myFun = String.join ", "

Running on Strings produces:

myFun : List String -> String 
myFun = String.join ", "
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

1 participant