1 module PursLoader.Options
6 import Prelude ((<$>), (<<<), id)
8 import Data.Foreign.Class (IsForeign, readProp)
9 import Data.Foreign.NullOrUndefined (runNullOrUndefined)
10 import Data.Maybe (maybe)
12 import PursLoader.Path (joinPath)
14 newtype Options = Options { pscBundle :: String }
16 type Options_ = { pscBundle :: String }
18 runOptions :: Options -> Options_
19 runOptions (Options options) = options
21 instance isForeignOptions :: IsForeign Options where
23 Options <$> ({ pscBundle: _ }
24 <$> (maybe pscBundleDefault id <<< runNullOrUndefined <$> readProp pscBundle obj))
27 pscBundle = "pscBundle"
29 pscBundleDefault :: String
30 pscBundleDefault = joinPath "output" "bundle.js"