Skip to content

Commit

Permalink
renamed bufferLocalStorageKey to haskellBufferLocalStorageKey
Browse files Browse the repository at this point in the history
  • Loading branch information
hrajchert committed Jan 26, 2021
1 parent e2d0164 commit 4cf12a5
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 11 deletions.
10 changes: 4 additions & 6 deletions marlowe-playground-client/src/HaskellEditor/State.purs
Expand Up @@ -11,8 +11,6 @@ import BottomPanel.State (handleAction) as BottomPanel
import BottomPanel.Types (Action(..), State) as BottomPanel
import CloseAnalysis (analyseClose)
import Control.Monad.Except (ExceptT, runExceptT)
import Control.Monad.Maybe.Extra (hoistMaybe)
import Control.Monad.Maybe.Trans (runMaybeT)
import Control.Monad.Reader (runReaderT)
import Data.Array (catMaybes)
import Data.Either (Either(..), hush)
Expand Down Expand Up @@ -41,7 +39,7 @@ import Servant.PureScript.Settings (SPSettings_)
import StaticAnalysis.Reachability (analyseReachability)
import StaticAnalysis.StaticTools (analyseContract)
import StaticAnalysis.Types (AnalysisState(..), MultiStageAnalysisData(..), _analysisState)
import StaticData (bufferLocalStorageKey)
import StaticData (haskellBufferLocalStorageKey)
import Types (WebData)
import Webghc.Server (CompileRequest(..))

Expand All @@ -60,11 +58,11 @@ handleAction ::
HalogenM State Action ChildSlots Void m Unit
handleAction _ Init = do
editorSetTheme
mContents <- liftEffect $ LocalStorage.getItem bufferLocalStorageKey
mContents <- liftEffect $ LocalStorage.getItem haskellBufferLocalStorageKey
editorSetValue $ fromMaybe "" mContents

handleAction _ (HandleEditorMessage (Monaco.TextChanged text)) = do
liftEffect $ LocalStorage.setItem bufferLocalStorageKey text
liftEffect $ LocalStorage.setItem haskellBufferLocalStorageKey text
assign _compilationResult NotAsked

handleAction _ (ChangeKeyBindings bindings) = do
Expand Down Expand Up @@ -99,7 +97,7 @@ handleAction _ SendResultToSimulator = pure unit

handleAction _ (InitHaskellProject contents) = do
editorSetValue contents
liftEffect $ LocalStorage.setItem bufferLocalStorageKey contents
liftEffect $ LocalStorage.setItem haskellBufferLocalStorageKey contents

handleAction settings AnalyseContract = compileAndAnalyze settings (WarningAnalysis Loading) $ analyseContract settings

Expand Down
8 changes: 3 additions & 5 deletions marlowe-playground-client/src/StaticData.purs
@@ -1,5 +1,5 @@
module StaticData
( bufferLocalStorageKey
( haskellBufferLocalStorageKey
, jsBufferLocalStorageKey
, demoFiles
, demoFilesJS
Expand All @@ -18,7 +18,6 @@ import Examples.Haskell.Contracts (contractForDifference, couponBondGuaranteed,
import Examples.JS.Contracts (cfd, couponBondGuaranteed, escrow, example, swap, zeroCouponBond) as JSE
import Examples.Marlowe.Contracts (contractForDifference, escrow, example, option, swap, zeroCouponBond) as ME
import LocalStorage as LocalStorage
import Prim.TypeError (class Warn, Text)

type Label
= String
Expand Down Expand Up @@ -66,10 +65,9 @@ marloweContract ::
Contents
marloweContract = "(Some Marlowe Code)"

bufferLocalStorageKey ::
Warn (Text "Refactor bufferLocalStorageKey -> haskellBufferLocalStorageKey") =>
haskellBufferLocalStorageKey ::
LocalStorage.Key
bufferLocalStorageKey = LocalStorage.Key "HaskellBuffer"
haskellBufferLocalStorageKey = LocalStorage.Key "HaskellBuffer"

jsBufferLocalStorageKey ::
LocalStorage.Key
Expand Down

0 comments on commit 4cf12a5

Please sign in to comment.