{-# LANGUAGE DeriveGeneric, OverloadedStrings, DataKinds #-}
module Numeric.Datasets.Coal ( Coal, coal, date ) where
import Numeric.Datasets
import Data.Csv
import GHC.Generics
import Network.HTTP.Req ((/:), http, Scheme(..))
newtype Coal = Coal
{ date :: Double
} deriving (Show, Read, Generic)
instance FromRecord Coal where
parseRecord v = Coal <$> v .! 1
coal :: Dataset Coal
coal = let src = URL $ http "vincentarelbundock.github.io" /: "Rdatasets" /: "csv" /: "boot" /: "coal.csv"
in Dataset src Nothing Nothing $ CSVRecord HasHeader defaultDecodeOptions