From 4f55630ef9ec00dc70910b37892f9fee5798aa17 Mon Sep 17 00:00:00 2001 From: Alice BRENON <alice.brenon@ens-lyon.fr> Date: Tue, 26 Sep 2023 13:04:22 +0200 Subject: [PATCH] Reverse associativity of '@': we want to enrich metadata on the right of lines, without having to explode existing structures. A paragraph with a class should be just that, and not an article combined to a paragraph number and a class: (Article @ Paragraph) @ Class, not Article @ (Paragraph @ Class) --- lib/GEODE/Metadata/Types.hs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/GEODE/Metadata/Types.hs b/lib/GEODE/Metadata/Types.hs index 0999f7d..0a038b2 100644 --- a/lib/GEODE/Metadata/Types.hs +++ b/lib/GEODE/Metadata/Types.hs @@ -9,8 +9,8 @@ import Data.Aeson.KeyMap as Object (union) import Data.Csv (FromNamedRecord(..), ToNamedRecord(..)) import Data.HashMap.Strict as Hash (union) -infixr 9 @ -infixr 9 :@: +infixl 9 @ +infixl 9 :@: data a @ b = a :@: b class Has a b where @@ -19,11 +19,11 @@ class Has a b where instance Has a a where get = id -instance Has a c => Has a (b @ c) where - get (_ :@: c) = get c +instance Has a b => Has a (b @ c) where + get (b :@: _) = get b -instance {-# OVERLAPS #-} Has a (a @ b) where - get (a :@: _) = a +instance {-# OVERLAPS #-} Has b (a @ b) where + get (_ :@: b) = b instance (ToNamedRecord a, ToNamedRecord b) => ToNamedRecord (a @ b) where toNamedRecord (a :@: b) = Hash.union (toNamedRecord a) (toNamedRecord b) -- GitLab