Skip to content

Instantly share code, notes, and snippets.

@codedmart
Last active December 2, 2015 20:53
Show Gist options
  • Select an option

  • Save codedmart/1872f7c9658dbdaa384a to your computer and use it in GitHub Desktop.

Select an option

Save codedmart/1872f7c9658dbdaa384a to your computer and use it in GitHub Desktop.
module Stores.App where
import Prelude
import Data.Maybe
import Control.Monad.Eff
import Control.Monad.Eff.Console (log)
import Signal (foldp, runSignal)
import Signal.Channel (channel, subscribe)
import Types.AspectRatio
foreign import data Blob :: *
type SvgData =
{ aspectRatio :: AspectRatio
, mimeType :: String
, name :: String
, size :: Int
, title :: String
, uploadType :: String
, userId :: Maybe String
}
type AppUpload =
{ svg :: Maybe Blob
, svgData :: Maybe SvgData
, svgString :: Maybe String
}
type AppAlert =
{ message :: Maybe String
, type :: Maybe String
, wrapperClass :: Maybe String
, link :: Maybe String
}
type AppState =
{ upload :: AppUpload
, alert :: AppAlert
, loginModalIsOpen :: Boolean
, cartModalIsOpen :: Boolean
, modalImageWarningIsOpen :: Boolean
, modalVectorWarningIsOpen :: Boolean
, openModals :: Array String
, localStorageAvailable :: Boolean
}
data Action =
NoOp
| Update AppState
initialUpload :: AppUpload
initialUpload =
{ svg: Nothing
, svgData: Nothing
, svgString: Nothing
}
initialAlert :: AppAlert
initialAlert =
{ message: Nothing
, type: Nothing
, wrapperClass: Nothing
, link: Nothing
}
initialState :: AppState
initialState =
{ upload: initialUpload
, alert: initialAlert
, loginModalIsOpen: false
, cartModalIsOpen: false
, modalImageWarningIsOpen: false
, modalVectorWarningIsOpen: false
, openModals: []
, localStorageAvailable: true
}
update :: Action -> AppState -> AppState
update action state = case action of
Update st -> st
NoOp -> state
main = do
chan <- channel NoOp
let acts = subscribe chan
let appState = foldp update initialState acts
runSignal appState
Error found:
in module Stores.App
at /Users/bmartin/Work/lumi/lumi-flapjack/./purescript/src/Stores/App.purs line 102, column 3 - line 102, column 13
Could not match type
Object
with type
Eff _0
while trying to match type Object
with type Eff _0
while checking that expression appState
has type Signal (Eff _0 Unit)
in value declaration main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment