git.iko.soy/rowtype-yoga/purescript-yoga-om-layer
on v1.0.4 help sign in
23 lines 805 B history raw
1module Test.Negative.MultipleMissing where
3import Prelude
4import Data.Maybe (Maybe(..))
5import Effect (Effect)
6import Yoga.Om (Om)
7import Yoga.Om as Om
8import Yoga.Om.Layer (OmLayer, makeLayer, runLayer)
10type Config = { port :: Int }
11type Logger = { log :: String -> Effect Unit }
12type Database = { query :: String -> Effect (Array String) }
13type Cache = { get :: String -> Effect (Maybe String) }
15-- Needs THREE dependencies
16needsThree :: OmLayer (config :: Config, logger :: Logger, database :: Database) (cache :: Cache) ()
17needsThree = makeLayer do
18 { config, logger, database } <- Om.ask
19 pure { cache: { get: \_ -> pure Nothing } }
21-- Provides NONE of them - what error do we get?
22testMultipleMissing :: Om (Record ()) () (Record (cache :: Cache))
23testMultipleMissing = runLayer {} needsThree