diff --git a/src/DataFrame/IO/CSV.hs b/src/DataFrame/IO/CSV.hs index 1a055d2..450cb3c 100644 --- a/src/DataFrame/IO/CSV.hs +++ b/src/DataFrame/IO/CSV.hs @@ -428,11 +428,9 @@ getRowAsText df i = V.ifoldr go [] (columns df) ++ "the other columns at index " ++ show i go k (OptionalColumn (c :: V.Vector (Maybe a))) acc = case c V.!? i of - Just e -> textRep : acc - where - textRep = case testEquality (typeRep @a) (typeRep @T.Text) of - Just Refl -> fromMaybe "Nothing" e - Nothing -> (T.pack . show) e + Just e -> case testEquality (typeRep @a) (typeRep @T.Text) of + Just Refl -> fromMaybe T.empty e : acc + Nothing -> maybe T.empty (T.pack . show) e : acc Nothing -> error $ "Column " diff --git a/src/DataFrame/Lazy/IO/CSV.hs b/src/DataFrame/Lazy/IO/CSV.hs index a1bc795..734e7e3 100644 --- a/src/DataFrame/Lazy/IO/CSV.hs +++ b/src/DataFrame/Lazy/IO/CSV.hs @@ -383,11 +383,9 @@ getRowAsText df i = V.ifoldr go [] (columns df) ++ "the other columns at index " ++ show i go k (OptionalColumn (c :: V.Vector (Maybe a))) acc = case c V.!? i of - Just e -> textRep : acc - where - textRep = case testEquality (typeRep @a) (typeRep @T.Text) of - Just Refl -> fromMaybe "Nothing" e - Nothing -> (T.pack . show) e + Just e -> case testEquality (typeRep @a) (typeRep @T.Text) of + Just Refl -> fromMaybe T.empty e : acc + Nothing -> maybe T.empty (T.pack . show) e : acc Nothing -> error $ "Column "