Skip to content

Commit

Permalink
Define Incomplete and Complete type aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
jasagredo committed Apr 16, 2024
1 parent 323df71 commit d088bdd
Showing 1 changed file with 7 additions and 2 deletions.
@@ -1,4 +1,5 @@
{-# LANGUAGE DeriveFunctor #-}
{-# LANGUAGE PolyKinds #-}
{-# LANGUAGE TypeFamilies #-}
-- | Utilities for arguments record with defaults
--
Expand Down Expand Up @@ -33,10 +34,13 @@ module Ouroboros.Consensus.Util.Args (
, HKD
, MapHKD (..)
-- * Re-exported for convenience
, Complete
, Identity (..)
, Incomplete
) where

import Data.Functor.Identity (Identity (..))
import Data.Kind

data Defaults t = NoDefault
deriving (Functor)
Expand All @@ -45,6 +49,9 @@ type family HKD f a where
HKD Identity a = a
HKD f a = f a

type Incomplete (args :: (Type -> Type) -> k) = args Defaults
type Complete (args :: (Type -> Type) -> k) = args Identity

class MapHKD f where
mapHKD :: proxy (f b) -> (a -> b) -> HKD f a -> HKD f b

Expand All @@ -53,5 +60,3 @@ instance MapHKD Identity where

instance MapHKD Defaults where
mapHKD _ _ = const NoDefault


0 comments on commit d088bdd

Please sign in to comment.