]> git.immae.eu Git - github/fretlink/purs-loader.git/blame - src/PursLoader/Options.purs
Updating example
[github/fretlink/purs-loader.git] / src / PursLoader / Options.purs
CommitLineData
c194f84c 1module PursLoader.Options
63d6a244 2 ( Options()
3 , runOptions
c194f84c 4 ) where
5
63d6a244 6import Prelude ((<$>), (<<<), id)
03b840cb 7
63d6a244 8import Data.Foreign.Class (IsForeign, readProp)
9import Data.Foreign.NullOrUndefined (runNullOrUndefined)
10import Data.Maybe (maybe)
c194f84c 11
63d6a244 12import PursLoader.Path (joinPath)
c194f84c 13
63d6a244 14newtype Options = Options { pscBundle :: String }
c194f84c 15
63d6a244 16type Options_ = { pscBundle :: String }
c194f84c 17
63d6a244 18runOptions :: Options -> Options_
19runOptions (Options options) = options
2b620717 20
c194f84c 21instance isForeignOptions :: IsForeign Options where
63d6a244 22 read obj =
23 Options <$> ({ pscBundle: _ }
24 <$> (maybe pscBundleDefault id <<< runNullOrUndefined <$> readProp pscBundle obj))
25 where
26 pscBundle :: String
27 pscBundle = "pscBundle"
28
29 pscBundleDefault :: String
30 pscBundleDefault = joinPath "output" "bundle.js"