Skip to content

Instantly share code, notes, and snippets.

@ramirez7
Created September 30, 2022 17:54
Show Gist options
  • Select an option

  • Save ramirez7/dd0e1768625f7a894419a267d9ca22aa to your computer and use it in GitHub Desktop.

Select an option

Save ramirez7/dd0e1768625f7a894419a267d9ca22aa to your computer and use it in GitHub Desktop.
newtype Aligned f a = Aligned { unAligned :: f a }
instance (Semigroup a, Semialign f) => Semigroup (Aligned f a) where
Aligned x1 <> Aligned x2 = Aligned $ Data.Align.salign x1 x2
instance (Semigroup a, Align f) => Monoid (Aligned f a) where
mempty = Aligned Data.Align.nil
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment