Skip to content

Commit

Permalink
Refine naming to read slightly better
Browse files Browse the repository at this point in the history
  • Loading branch information
supermario committed Apr 28, 2024
1 parent f8f8b2b commit e6022ea
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 12 deletions.
2 changes: 1 addition & 1 deletion builder/src/Generate.hs
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ prod root details (Build.Artifacts pkg _ roots modules) =
checkForDebugUses objects
let graph_ = objectsToGlobalGraph objects
graph <- Task.io $ Lamdera.AppConfig.injectConfig graph_
longNamesEnabled <- Task.io $ Lamdera.isLongNamesEnabled
longNamesEnabled <- Task.io $ Lamdera.useLongNames
let mode = Mode.Prod (Mode.shortenFieldNames graph)
& Lamdera.alternativeImplementationWhen longNamesEnabled
(Mode.Prod (Mode.legibleFieldNames graph))
Expand Down
17 changes: 6 additions & 11 deletions extra/Lamdera.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ module Lamdera
, isWireEnabled_
, useLongNames_
, enableLongNames
, isLongNamesEnabled
, isLongNamesEnabled_
, useLongNames
, isTest
, isLiveMode
, setLiveMode
Expand Down Expand Up @@ -442,20 +441,16 @@ isWireEnabled_ = unsafePerformIO $ isWireEnabled
useLongNames_ :: MVar Bool
useLongNames_ = unsafePerformIO $ newMVar False

{-# NOINLINE useLongNames #-}
useLongNames :: IO Bool
useLongNames = do
readMVar useLongNames_

enableLongNames :: IO ()
enableLongNames = do
debug $ "🗜️ enableLongNames"
modifyMVar_ useLongNames_ (\_ -> pure True)

{-# NOINLINE isLongNamesEnabled #-}
isLongNamesEnabled :: IO Bool
isLongNamesEnabled = do
readMVar useLongNames_

{-# NOINLINE isLongNamesEnabled_ #-}
isLongNamesEnabled_ :: Bool
isLongNamesEnabled_ = unsafePerformIO $ isLongNamesEnabled


isTest :: IO Bool
isTest = do
Expand Down

0 comments on commit e6022ea

Please sign in to comment.