@@ -25,7 +25,7 @@ data SSFUDG =
2525 deriving (Eq , Ord , Generic , Enum , Bounded )
2626
2727instance Makeable SSFUDG where
28- make x
28+ make _ x
2929 | x == " minus" = pure SSFMinus
3030 | x == " half" = pure SSFHalf
3131 | x == " plus" = pure SSFPlus
@@ -37,7 +37,7 @@ instance Show SSFUDG where
3737 show SSFHalf = " half"
3838 show SSFPlus = " plus"
3939instance Csv. ToField SSFUDG where toField x = Csv. toField $ show x
40- instance Csv. FromField SSFUDG where parseField = parseTypeCSV " udg"
40+ instance FromFieldVersioned SSFUDG where parseFieldVersioned pv = parseTypeCSV pv " udg"
4141
4242-- | A datatype for the library_built .ssf column
4343data SSFLibraryBuilt =
@@ -46,7 +46,7 @@ data SSFLibraryBuilt =
4646 deriving (Eq , Ord , Generic , Enum , Bounded )
4747
4848instance Makeable SSFLibraryBuilt where
49- make x
49+ make _ x
5050 | x == " ds" = pure SSFDS
5151 | x == " ss" = pure SSFSS
5252 | otherwise = fail $ " library_built is set to " ++ show x ++ " . " ++
@@ -56,14 +56,14 @@ instance Show SSFLibraryBuilt where
5656 show SSFDS = " ds"
5757 show SSFSS = " ss"
5858instance Csv. ToField SSFLibraryBuilt where toField x = Csv. toField $ show x
59- instance Csv. FromField SSFLibraryBuilt where parseField = parseTypeCSV " library_built"
59+ instance FromFieldVersioned SSFLibraryBuilt where parseFieldVersioned pv = parseTypeCSV pv " library_built"
6060
6161-- | A datatype for the sample_accession .ssf column
6262newtype SSFAccessionIDSample = SSFAccessionIDSample AccessionID
6363 deriving (Eq , Ord , Generic )
6464
6565instance Makeable SSFAccessionIDSample where
66- make x = do
66+ make _ x = do
6767 accID <- makeAccessionID x
6868 return $ SSFAccessionIDSample accID
6969instance Suspicious SSFAccessionIDSample where
@@ -76,14 +76,14 @@ instance Suspicious SSFAccessionIDSample where
7676instance Show SSFAccessionIDSample where
7777 show (SSFAccessionIDSample x) = show x
7878instance Csv. ToField SSFAccessionIDSample where toField x = Csv. toField $ show x
79- instance Csv. FromField SSFAccessionIDSample where parseField = parseTypeCSV " sample_accession"
79+ instance FromFieldVersioned SSFAccessionIDSample where parseFieldVersioned pv = parseTypeCSV pv " sample_accession"
8080
8181-- | A datatype for the study_accession .ssf column
8282newtype SSFAccessionIDStudy = SSFAccessionIDStudy AccessionID
8383 deriving (Eq , Ord , Generic )
8484
8585instance Makeable SSFAccessionIDStudy where
86- make x = do
86+ make _ x = do
8787 accID <- makeAccessionID x
8888 return $ SSFAccessionIDStudy accID
8989instance Suspicious SSFAccessionIDStudy where
@@ -96,14 +96,14 @@ instance Suspicious SSFAccessionIDStudy where
9696instance Show SSFAccessionIDStudy where
9797 show (SSFAccessionIDStudy x) = show x
9898instance Csv. ToField SSFAccessionIDStudy where toField x = Csv. toField $ show x
99- instance Csv. FromField SSFAccessionIDStudy where parseField = parseTypeCSV " study_accession"
99+ instance FromFieldVersioned SSFAccessionIDStudy where parseFieldVersioned pv = parseTypeCSV pv " study_accession"
100100
101101-- | A datatype for the run_accession .ssf column
102102newtype SSFAccessionIDRun = SSFAccessionIDRun AccessionID
103103 deriving (Eq , Ord , Generic )
104104
105105instance Makeable SSFAccessionIDRun where
106- make x = do
106+ make _ x = do
107107 accID <- makeAccessionID x
108108 return $ SSFAccessionIDRun accID
109109instance Suspicious SSFAccessionIDRun where
@@ -115,7 +115,7 @@ instance Suspicious SSFAccessionIDRun where
115115instance Show SSFAccessionIDRun where
116116 show (SSFAccessionIDRun x) = show x
117117instance Csv. ToField SSFAccessionIDRun where toField x = Csv. toField $ show x
118- instance Csv. FromField SSFAccessionIDRun where parseField = parseTypeCSV " run_accession"
118+ instance FromFieldVersioned SSFAccessionIDRun where parseFieldVersioned pv = parseTypeCSV pv " run_accession"
119119
120120-- | A datatype for the sample_alias .ssf column
121121newtype SSFSampleAlias = SSFSampleAlias T. Text deriving (Eq , Ord )
@@ -130,7 +130,7 @@ newtype SSFFirstPublicSimpleDate = SSFFirstPublicSimpleDate Day
130130 deriving (Eq , Ord , Generic )
131131
132132instance Makeable SSFFirstPublicSimpleDate where
133- make x = do
133+ make _ x = do
134134 case parseTimeM False defaultTimeLocale " %Y-%-m-%-d" (T. unpack x) :: Maybe Day of
135135 Nothing -> fail $ " first_public date " ++ T. unpack x ++
136136 " is not a correct date in the format YYYY-MM-DD."
@@ -140,15 +140,15 @@ instance Show SSFFirstPublicSimpleDate where
140140 show (SSFFirstPublicSimpleDate x) = formatTime defaultTimeLocale " %Y-%-m-%-d" x
141141instance Csv. ToField SSFFirstPublicSimpleDate where
142142 toField (SSFFirstPublicSimpleDate x) = Csv. toField $ show x
143- instance Csv. FromField SSFFirstPublicSimpleDate where
144- parseField = parseTypeCSV " first_public"
143+ instance FromFieldVersioned SSFFirstPublicSimpleDate where
144+ parseFieldVersioned pv = parseTypeCSV pv " first_public"
145145
146146-- | A datatype for the last_updated .ssf column
147147newtype SSFLastUpdatedSimpleDate = SSFLastUpdatedSimpleDate Day
148148 deriving (Eq , Ord , Generic )
149149
150150instance Makeable SSFLastUpdatedSimpleDate where
151- make x = do
151+ make _ x = do
152152 case parseTimeM False defaultTimeLocale " %Y-%-m-%-d" (T. unpack x) :: Maybe Day of
153153 Nothing -> fail $ " last_updated date " ++ T. unpack x ++
154154 " is not a correct date in the format YYYY-MM-DD."
@@ -158,8 +158,8 @@ instance Show SSFLastUpdatedSimpleDate where
158158 show (SSFLastUpdatedSimpleDate x) = formatTime defaultTimeLocale " %Y-%-m-%-d" x
159159instance Csv. ToField SSFLastUpdatedSimpleDate where
160160 toField (SSFLastUpdatedSimpleDate x) = Csv. toField $ show x
161- instance Csv. FromField SSFLastUpdatedSimpleDate where
162- parseField = parseTypeCSV " last_updated"
161+ instance FromFieldVersioned SSFLastUpdatedSimpleDate where
162+ parseFieldVersioned pv = parseTypeCSV pv " last_updated"
163163
164164-- | A datatype for the instrument_model .ssf column
165165newtype SSFInstrumentModel = SSFInstrumentModel T. Text deriving (Eq , Ord )
@@ -190,48 +190,48 @@ newtype SSFFastqFTPURI = SSFFastqFTPURI T.Text
190190 deriving (Eq , Ord , Generic )
191191
192192instance Makeable SSFFastqFTPURI where
193- make x
193+ make _ x
194194 | isURIReference (T. unpack x) = pure $ SSFFastqFTPURI x
195195 | otherwise = fail $ " fastq_ftp entry " ++ show x ++
196196 " is not a well-structured URI."
197197instance Suspicious SSFFastqFTPURI where inspect _ = Nothing
198198instance Show SSFFastqFTPURI where show (SSFFastqFTPURI x) = T. unpack x
199199instance Csv. ToField SSFFastqFTPURI where toField x = Csv. toField $ show x
200- instance Csv. FromField SSFFastqFTPURI where parseField = parseTypeCSV " fastq_ftp"
200+ instance FromFieldVersioned SSFFastqFTPURI where parseFieldVersioned pv = parseTypeCSV pv " fastq_ftp"
201201
202202-- | A datatype for the fastq_aspera .ssf column
203203newtype SSFFastqASPERAURI = SSFFastqASPERAURI T. Text
204204 deriving (Eq , Ord , Generic )
205205
206206instance Makeable SSFFastqASPERAURI where
207- make x
207+ make _ x
208208 | isURIReference (T. unpack x) = pure $ SSFFastqASPERAURI x
209209 | otherwise = fail $ " fastq_aspera entry " ++ show x ++
210210 " is not a well-structured URI."
211211instance Suspicious SSFFastqASPERAURI where inspect _ = Nothing
212212instance Show SSFFastqASPERAURI where show (SSFFastqASPERAURI x) = T. unpack x
213213instance Csv. ToField SSFFastqASPERAURI where toField x = Csv. toField $ show x
214- instance Csv. FromField SSFFastqASPERAURI where parseField = parseTypeCSV " fastq_aspera"
214+ instance FromFieldVersioned SSFFastqASPERAURI where parseFieldVersioned pv = parseTypeCSV pv " fastq_aspera"
215215
216216-- | A datatype for the fastq_bytes .ssf column
217217newtype SSFFastqBytes = SSFFastqBytes Integer deriving (Eq , Ord , Generic )
218218
219219instance Makeable SSFFastqBytes where
220- make x =
220+ make _ x =
221221 case T. decimal x of
222222 Left e -> fail $ " fastq_bytes can not be converted to Integer because " ++ e
223223 Right (num, " " ) -> pure $ SSFFastqBytes num
224224 Right (_, rest) -> fail $ " fastq_bytes can not be converted to Integer, because of a trailing " ++ show rest
225225instance Suspicious SSFFastqBytes where inspect _ = Nothing
226226instance Show SSFFastqBytes where show (SSFFastqBytes x) = show x
227227instance Csv. ToField SSFFastqBytes where toField (SSFFastqBytes x) = Csv. toField x
228- instance Csv. FromField SSFFastqBytes where parseField = parseTypeCSV " fastq_bytes"
228+ instance FromFieldVersioned SSFFastqBytes where parseFieldVersioned pv = parseTypeCSV pv " fastq_bytes"
229229
230230-- | A datatype for the fastq_md5 .ssf column
231231newtype SSFFastqMD5 = SSFFastqMD5 T. Text deriving (Eq , Ord , Generic )
232232
233233instance Makeable SSFFastqMD5 where
234- make x
234+ make _ x
235235 | isMD5Hash x = pure $ SSFFastqMD5 x
236236 | otherwise = fail $ " fastq_md5 " ++ show x ++
237237 " does not contain a well-structured MD5 hash"
@@ -240,13 +240,13 @@ isMD5Hash x = T.length x == 32 && T.all isHexDigit x
240240instance Suspicious SSFFastqMD5 where inspect _ = Nothing
241241instance Show SSFFastqMD5 where show (SSFFastqMD5 x) = T. unpack x
242242instance Csv. ToField SSFFastqMD5 where toField x = Csv. toField $ show x
243- instance Csv. FromField SSFFastqMD5 where parseField = parseTypeCSV " fastq_md5"
243+ instance FromFieldVersioned SSFFastqMD5 where parseFieldVersioned pv = parseTypeCSV pv " fastq_md5"
244244
245245-- | A datatype for the fastq_bytes .ssf column
246246newtype SSFReadCount = SSFReadCount Integer deriving (Eq , Ord , Generic )
247247
248248instance Makeable SSFReadCount where
249- make x =
249+ make _ x =
250250 case T. signed T. decimal x of -- the ENA uses -1 in case the read count failed
251251 Left e -> fail $ " read_count can not be converted to Integer because " ++ e
252252 Right (num, " " ) ->
@@ -260,31 +260,31 @@ instance Suspicious SSFReadCount where
260260 | otherwise = pure []
261261instance Show SSFReadCount where show (SSFReadCount x) = show x
262262instance Csv. ToField SSFReadCount where toField (SSFReadCount x) = Csv. toField x
263- instance Csv. FromField SSFReadCount where parseField = parseTypeCSV " read_count"
263+ instance FromFieldVersioned SSFReadCount where parseFieldVersioned pv = parseTypeCSV pv " read_count"
264264
265265-- | A datatype for the submitted_ftp .ssf column
266266newtype SSFSubmittedFTPURI = SSFSubmittedFTPURI T. Text
267267 deriving (Eq , Ord , Generic )
268268
269269instance Makeable SSFSubmittedFTPURI where
270- make x
270+ make _ x
271271 | isURIReference (T. unpack x) = pure $ SSFSubmittedFTPURI x
272272 | otherwise = fail $ " submitted_ftp entry " ++ show x ++
273273 " is not a well-structured URI."
274274instance Suspicious SSFSubmittedFTPURI where inspect _ = Nothing
275275instance Show SSFSubmittedFTPURI where show (SSFSubmittedFTPURI x) = T. unpack x
276276instance Csv. ToField SSFSubmittedFTPURI where toField x = Csv. toField $ show x
277- instance Csv. FromField SSFSubmittedFTPURI where parseField = parseTypeCSV " submitted_ftp"
277+ instance FromFieldVersioned SSFSubmittedFTPURI where parseFieldVersioned pv = parseTypeCSV pv " submitted_ftp"
278278
279279-- | A datatype for the submitted_md5 .ssf column
280280newtype SSFSubmittedMD5 = SSFSubmittedMD5 T. Text deriving (Eq , Ord , Generic )
281281
282282instance Makeable SSFSubmittedMD5 where
283- make x
283+ make _ x
284284 | isMD5Hash x = pure $ SSFSubmittedMD5 x
285285 | otherwise = fail $ " submitted_md5 " ++ show x ++
286286 " does not contain a well-structured MD5 hash"
287287instance Suspicious SSFSubmittedMD5 where inspect _ = Nothing
288288instance Show SSFSubmittedMD5 where show (SSFSubmittedMD5 x) = T. unpack x
289289instance Csv. ToField SSFSubmittedMD5 where toField x = Csv. toField $ show x
290- instance Csv. FromField SSFSubmittedMD5 where parseField = parseTypeCSV " submitted_md5"
290+ instance FromFieldVersioned SSFSubmittedMD5 where parseFieldVersioned pv = parseTypeCSV pv " submitted_md5"
0 commit comments