forked from enso-org/enso
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CollapseToFunction request. enso-org#28
- Loading branch information
1 parent
ed3c9fe
commit 8f2a7dc
Showing
14 changed files
with
104 additions
and
25 deletions.
There are no files selected for viewing
37 changes: 37 additions & 0 deletions
37
libs/luna-studio-common/src/LunaStudio/API/Graph/CollapseToFunction.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
module LunaStudio.API.Graph.CollapseToFunction where | ||
|
||
import Data.Binary (Binary) | ||
import qualified LunaStudio.API.Graph.Request as G | ||
import LunaStudio.API.Graph.Result (Result) | ||
import qualified LunaStudio.API.Request as R | ||
import qualified LunaStudio.API.Response as Response | ||
import qualified LunaStudio.API.Topic as T | ||
import LunaStudio.Data.Connection (Connection) | ||
import LunaStudio.Data.GraphLocation (GraphLocation) | ||
import LunaStudio.Data.Node (ExpressionNode) | ||
import LunaStudio.Data.NodeLoc (NodeLoc) | ||
import Prologue hiding (TypeRep) | ||
|
||
|
||
data Request = Request { _location :: GraphLocation | ||
, _nodeLocs :: [NodeLoc] | ||
} deriving (Eq, Generic, NFData, Show) | ||
|
||
data Inverse = Inverse { _nodes :: [ExpressionNode] | ||
, _connections :: [Connection] | ||
} deriving (Eq, Generic, NFData, Show) | ||
|
||
makeLenses ''Request | ||
makeLenses ''Inverse | ||
instance Binary Request | ||
instance Binary Inverse | ||
instance G.GraphRequest Request where location = location | ||
|
||
|
||
type Response = Response.Response Request Inverse Result | ||
instance Response.ResponseResult Request Inverse Result | ||
|
||
topicPrefix :: T.Topic | ||
topicPrefix = "empire.graph.node.collapsetofunction" | ||
instance T.MessageTopic (R.Request Request) where topic _ = topicPrefix <> T.request | ||
instance T.MessageTopic Response where topic _ = topicPrefix <> T.response |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 13 additions & 0 deletions
13
luna-studio/node-editor/src/NodeEditor/Action/Basic/CollapseToFunction.hs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
module NodeEditor.Action.Basic.CollapseToFunction where | ||
|
||
import Common.Prelude | ||
import qualified NodeEditor.Action.Batch as Batch | ||
import NodeEditor.Action.Command (Command) | ||
import NodeEditor.Action.State.NodeEditor (getSelectedNodes) | ||
import NodeEditor.React.Model.Node (nodeLoc) | ||
import NodeEditor.State.Global (State) | ||
|
||
|
||
|
||
collapseToFunction :: Command State () | ||
collapseToFunction = Batch.collapseToFunction =<< view nodeLoc `fmap2` getSelectedNodes |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters