Skip to content

Instantly share code, notes, and snippets.

@Lysxia Lysxia/a.hs
Created Aug 1, 2019

What would you like to do?
{-# LANGUAGE RankNTypes, DerivingStrategies, GeneralizedNewtypeDeriving #-}
-- Defaults to newtype
newtype T_Def = T_Def Bool
deriving (Eq, Ord, Bounded)
-- Stock
newtype T_S = T_S Bool
deriving stock (Eq, Ord, Bounded)
-- Newtype
newtype T_NT = T_NT Bool
deriving newtype (Eq, Ord, Bounded)
-- Defaults to newtype (unless DeriveFunctor or DeriveFoldable are on)
newtype F_NT a = F_NT (Either Int a)
deriving (Functor, Foldable)
-- Defaults to newtype, fails
-- newtype F_NT_BAD a = F_NT_BAD (forall r. Either r a)
-- deriving (Functor, Foldable)
main = return ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.