
Hello, So I end-up for now with two singletons for my SomeDataCollection So I red the Datacollection from an xml file (col) then I create the SomeDataCollection type depending on a bunch of values found in the Datacollection. like this. return $ if "ref-" `isPrefixOf` imagePrefix col then case imageSuffix col of (Just "cbf") -> SomeDataCollection SCaracterization SCbf (coerce col) (Just "h5") -> SomeDataCollection SCaracterization SHdf5 (coerce col) (Just _) -> SomeDataCollection SCaracterization SCbf (coerce col) Nothing -> SomeDataCollection SCaracterization SCbf (coerce col) else case imageSuffix col of (Just "cbf") -> SomeDataCollection SCollect SCbf (coerce col) (Just "h5") -> SomeDataCollection SCollect SHdf5 (coerce col) (Just _) -> SomeDataCollection SCollect SCbf (coerce col) Nothing -> SomeDataCollection SCollect SCbf (coerce col) Now I would like to do something like let t = if "ref-" `isPrefixOf` imagePrefix col then SCaracterization else SCollect and then return SomeDatacollection t f (coerce col) But If I try to do this I have an error like this src/ISPyB/Soap.hs:119:37-44: error: • Couldn't match type ‘'Collect’ with ‘'Caracterization’ Expected type: SCollectType 'Caracterization Actual type: SCollectType 'Collect • In the expression: SCollect In the expression: if "ref-" `isPrefixOf` imagePrefix col then SCaracterization else SCollect In an equation for ‘t’: t = if "ref-" `isPrefixOf` imagePrefix col then SCaracterization else SCollect how can I fix this and make the code better to read. thanks Fred