From c9d918de8944fb89e11cf182501e9846ff4316e7 Mon Sep 17 00:00:00 2001 From: Alec Theriault Date: Sat, 4 Aug 2018 11:51:30 -0400 Subject: Latex type families (#734) * Support for type families in LaTeX The code is ported over from the XHTML backend. * Refactor XHTML and LaTeX family handling This is mostly a consolidation effort: stripping extra exports, inlining some short definitions, and trying to make the backends match. The LaTeX backend now has preliminary support for data families, although the only the data instance head is printed (not the actual constructors). Both backends also now use "newtype" for newtype data family instances. * Add some tests --- html-test/src/TypeFamilies3.hs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 html-test/src/TypeFamilies3.hs (limited to 'html-test/src/TypeFamilies3.hs') diff --git a/html-test/src/TypeFamilies3.hs b/html-test/src/TypeFamilies3.hs new file mode 100644 index 00000000..bde05fb8 --- /dev/null +++ b/html-test/src/TypeFamilies3.hs @@ -0,0 +1,21 @@ +{-# LANGUAGE TypeFamilies #-} + +module TypeFamilies3 where + +-- | A closed type family +type family Foo a where + Foo () = Int + Foo _ = () + +-- | An open family +type family Bar a + +type instance Bar Int = () +type instance Bar () = Int + +-- | A data family +data family Baz a + +data instance Baz () = Baz1 +data instance Baz Int = Baz2 Bool +newtype instance Baz Double = Baz3 Float -- cgit v1.2.3