Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

empty is badly broken #24

Open
treeowl opened this issue Nov 17, 2015 · 0 comments
Open

empty is badly broken #24

treeowl opened this issue Nov 17, 2015 · 0 comments

Comments

@treeowl
Copy link

treeowl commented Nov 17, 2015

empty is defined as

-- | A completely empty configuration.
empty :: Config
empty = Config "" $ unsafePerformIO $ do
          p <- newIORef []
          m <- newIORef H.empty
          s <- newIORef H.empty
          return BaseConfig {
                       cfgAuto = Nothing
                     , cfgPaths = p
                     , cfgMap = m
                     , cfgSubs = s
                     }
{-# NOINLINE empty #-}

If I let myEmpty = empty, and then apply something like addToConfig to myEmpty, suddenly myEmpty and empty are no longer equivalent. I believe the only sane thing to do is to remove empty altogether, replacing it with mkEmpty :: IO Config.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant