
Hello I have this type data MaskLocation = MaskLocation Text | MaskLocation'Tmpl Text | MaskLocation'Or MaskLocation MaskLocation deriving (Eq, Generic, Show) deriving anyclass (FromJSON, ToJSON) instance FieldEmitter MaskLocation where fieldEmitter (MaskLocation t) = t fieldEmitter (MaskLocation'Tmpl t) = t fieldEmitter (MaskLocation'Or l r) = fieldEmitter l <> " | " <> fieldEmitter r I just added the MaskLocation'Or constructor in order to allow writing "mymask.npy | mymask2.npy | ..." So my question how should I write the new parser here the parser for the MaskLocation without the MaskLocation'Or instance FieldParsable MaskLocation where fieldParser = do t ← takeText pure $ if "{scannumber:" `Data.Text.isInfixOf` t then MaskLocation'Tmpl t else MaskLocation t It seems to me that I need to consume all text until I find a '|', call the parser on the collected text and start again the process. But I do not have a clear idea of how to collect all the values once the process is over. If someone could help me design this parser, It would be great. thanks a lot Frederic