From cbdb612f85355930ea7a6fbc453edbdf76715f69 Mon Sep 17 00:00:00 2001 From: Chris Wells Date: Thu, 19 Dec 2024 11:46:31 -0600 Subject: Thinking about doing this in haskell --- src/Data/Name.hs | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 src/Data/Name.hs (limited to 'src/Data/Name.hs') diff --git a/src/Data/Name.hs b/src/Data/Name.hs new file mode 100644 index 0000000..4553cdc --- /dev/null +++ b/src/Data/Name.hs @@ -0,0 +1,13 @@ +module Text.Name + ( Name (..) + ) where + +data Name a = Name + { lastName :: !a + , firstName :: !a + , middleName :: !(Maybe a) + } deriving (Eq, Foldable, Functor, Generic, Ord, Show, Traversable) + +instance Applicative Name where + pure x = Name x x (pure x) + Name l f m <*> Name x y z = Name (l x) (f y) (m <*> z) -- cgit v1.2.3