Skip to content

Provide an abstract/unabstract refactoring #1197

@jakub-nlx

Description

@jakub-nlx

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 ", "

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions