kadena-io / juno

Smart Contracts Running on a BFT Hardened Raft
BSD 3-Clause "New" or "Revised" License
453 stars 53 forks source link

how about use makeClassy instead of makeLense for Config type? #26

Open lichengqian opened 8 years ago

lichengqian commented 8 years ago

Hi: how about use makeClassy for Config type?

in Config.hs

          module Juno.Types.Config
          ( Config(..)
          , HasConfig(..)   -- we don't have to list all the fields here
          , KeySet(..), ksClient, ksCluster
          ) where

             -- makeLense ''Config
             makeClassy ''Config

in Simple.hs

         instance HasConfig (RaftEnv m) where
             config = cfg

then we can access config field like this:

    nid <- view (cfg.nodeId)   -- it's ok
    nid <- view nodeId         -- it's ok too