<commit_before>{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
import qualified Data.Foldable as Foldable
import qualified Text.Blaze.Html.Renderer.String as R
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
-- import qualified Text.Blaze.Html.Renderer.Pretty as R

import Control.Monad (sequence, unless, zipWithM_)
import Data.Default.Class (Default(def))
import Data.List (intercalate, intersperse)
import Data.Monoid
import Data.Time
import Data.Time.ISO8601 (formatISO8601)

data Tag
    = Agda
    | Compiler
    | Concurrent
    | Elm
    | Erlang
    | Theory
    | Haskell
    | HotCodeSwap
    | HoTT
    | Reliability
    | Types
    | Web
    deriving Show

data Language
    = Cz
    | En
    | Sk
    deriving Show

type Explanation = String

data Possibly a
    = Present a
    -- ^ Resource is prsent ant it is 'a'.
    | NotYet
    -- ^ Resource not yet available (there is still posibility there will be).
    | NotPresent Explanation
    -- ^ Resource probaby won't be available, with some explanation/excuse.
    deriving Show

type URL = String

data Presentation = Presentation
    { title :: String
    , author :: String
    , language :: [Language]
    -- ^ In what language(s) talk can\ be/was.
    , tags :: [Tag]
    , slides :: Possibly URL
    -- ^ URL to slides of this presentation. 'Nothing' in case that there are
    -- no slides.
    , audio :: Possibly URL
    -- ^ URL to audio recording of this presentation or 'Nothing' if there is
    -- not any recording.
    , player :: Possibly URL
    -- ^ URL to web player able to handle audio recording of this presentation.
    -- Set to 'Nothing' in case that wab player is not provided.
    } deriving Show

instance Default Presentation where
    def = Presentation
        { title = "Unknown title"
        , author = "Unknown author"
        , language = []
        , tags = []
        , slides = NotYet
        , audio = NotYet
        , player = NotYet
        }

data Meetup = Meetup
    { indexM :: Integer
    -- ^ Meetups form a total order in time and is mapped in to linear ordering
    -- of 'Integer' numbers starting from 0.
    , presentations :: [Presentation]
    -- ^ List of presentations presented during meetup.
    , time :: Maybe ZonedTime
    -- ^ Time when the meetup occurred
    , participants :: Maybe Integer
    -- ^ Number of participats, for future, or meetups currently being held,
    -- this is set, obviously, to 'Nothing'.
    } deriving Show

possiblyMaybe = \case
    Present x -> Just x
    _ -> Nothing

futureMeetup :: Integer -> Meetup
futureMeetup idx = Meetup
    { indexM = idx
    , presentations = []
    , time = Nothing
    , participants = Nothing
    }

-- | Assign index to a 'Meetup'. It expects them to be in reverse order, i.e.
-- newest/future first and oldest as last.
checkMeetupsIndex :: [Meetup] -> [Meetup]
checkMeetupsIndex ms = case areCorrectlyOrdered ms of
    Right ()  -> ms
    Left  msg -> error msg
  where
    areCorrectlyOrdered = zipWithM_ checkIndex [0 ..] . reverse

    checkIndex expectedIndex m@Meetup{indexM = gotIndex} =
        unless (expectedIndex == gotIndex) . Left $ concat
            [ "Expected index ", show expectedIndex
            , ", but got ", show gotIndex
            , " in ", show m
            ]

-- | List of all meetups, those that already occurred and those that are
-- planned. Meetups are ordered from newest/future down to the oldest;
-- so please add new meetups on top.
meetups :: [Meetup]
meetups = checkMeetupsIndex
    [ Meetup
        { indexM = 6
        , presentations =
            [ Presentation
                { title = "Introduction to Agda"
                , author = "<NAME>"
                , language = [Sk]
                , tags = [Agda, Theory]
                , slides = Present "fpb-6/html/talk.html"
                , audio = NotPresent "Not recorded"
                , player = NotPresent "No audio recording"
                }
            ]
        , time = Just $ read "2016-10-13 19:00:00 +02:00"
        , participants = Just 20
        }
    , Meetup
        { indexM = 5
        , presentations =
            [ Presentation
                { title = "Types and Higher Groupoids"
                , author = "<NAME>"
                , language = [En]
                , tags = [HoTT, Theory]
                , slides = NotYet
                , audio = Present "fpb-5/fpb-5.ogg"
                , player = NotYet
                }
            ]
        , time = Just $ read "2016-07-27 18:00:00 +02:00"
        , participants = Just 12<commit_msg>Time and date of upcoming Meetup 7<commit_after>{-# LANGUAGE LambdaCase #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# OPTIONS_GHC -fno-warn-unused-do-bind #-}
import qualified Data.Foldable as Foldable
import qualified Text.Blaze.Html.Renderer.String as R
import qualified Text.Blaze.Html5 as H
import qualified Text.Blaze.Html5.Attributes as A
-- import qualified Text.Blaze.Html.Renderer.Pretty as R

import Control.Monad (sequence, unless, zipWithM_)
import Data.Default.Class (Default(def))
import Data.List (intercalate, intersperse)
import Data.Monoid
import Data.Time
import Data.Time.ISO8601 (formatISO8601)

data Tag
    = Agda
    | Compiler
    | Concurrent
    | Elm
    | Erlang
    | Theory
    | Haskell
    | HotCodeSwap
    | HoTT
    | Reliability
    | Types
    | Web
    deriving Show

data Language
    = Cz
    | En
    | Sk
    deriving Show

type Explanation = String

data Possibly a
    = Present a
    -- ^ Resource is prsent ant it is 'a'.
    | NotYet
    -- ^ Resource not yet available (there is still posibility there will be).
    | NotPresent Explanation
    -- ^ Resource probaby won't be available, with some explanation/excuse.
    deriving Show

type URL = String

data Presentation = Presentation
    { title :: String
    , author :: String
    , language :: [Language]
    -- ^ In what language(s) talk can\ be/was.
    , tags :: [Tag]
    , slides :: Possibly URL
    -- ^ URL to slides of this presentation. 'Nothing' in case that there are
    -- no slides.
    , audio :: Possibly URL
    -- ^ URL to audio recording of this presentation or 'Nothing' if there is
    -- not any recording.
    , player :: Possibly URL
    -- ^ URL to web player able to handle audio recording of this presentation.
    -- Set to 'Nothing' in case that wab player is not provided.
    } deriving Show

instance Default Presentation where
    def = Presentation
        { title = "Unknown title"
        , author = "Unknown author"
        , language = []
        , tags = []
        , slides = NotYet
        , audio = NotYet
        , player = NotYet
        }

data Meetup = Meetup
    { indexM :: Integer
    -- ^ Meetups form a total order in time and is mapped in to linear ordering
    -- of 'Integer' numbers starting from 0.
    , presentations :: [Presentation]
    -- ^ List of presentations presented during meetup.
    , time :: Maybe ZonedTime
    -- ^ Time when the meetup occurred
    , participants :: Maybe Integer
    -- ^ Number of participats, for future, or meetups currently being held,
    -- this is set, obviously, to 'Nothing'.
    } deriving Show

possiblyMaybe = \case
    Present x -> Just x
    _ -> Nothing

futureMeetup :: Integer -> Meetup
futureMeetup idx = Meetup
    { indexM = idx
    , presentations = []
    , time = Nothing
    , participants = Nothing
    }

-- | Assign index to a 'Meetup'. It expects them to be in reverse order, i.e.
-- newest/future first and oldest as last.
checkMeetupsIndex :: [Meetup] -> [Meetup]
checkMeetupsIndex ms = case areCorrectlyOrdered ms of
    Right ()  -> ms
    Left  msg -> error msg
  where
    areCorrectlyOrdered = zipWithM_ checkIndex [0 ..] . reverse

    checkIndex expectedIndex m@Meetup{indexM = gotIndex} =
        unless (expectedIndex == gotIndex) . Left $ concat
            [ "Expected index ", show expectedIndex
            , ", but got ", show gotIndex
            , " in ", show m
            ]

-- | List of all meetups, those that already occurred and those that are
-- planned. Meetups are ordered from newest/future down to the oldest;
-- so please add new meetups on top.
meetups :: [Meetup]
meetups = checkMeetupsIndex
    [ Meetup
        { indexM = 7
        , presentations = []
        , time = Just $ read "2017-02-22 19:00:00 +02:00"
        , participants = Nothing
        }
    , Meetup
        { indexM = 6
        , presentations =
            [ Presentation
                { title = "Introduction to Agda"
                , author = "<NAME>"
                , language = [Sk]
                , tags = [Agda, Theory]
                , slides = Present "fpb-6/html/talk.html"
                , audio = NotPresent "Not recorded"
                , player = NotPresent "No audio recording"
                }
            ]
        , time = Just $ read "2016-10-13 19:00:00 +02:00"
        , participants = Just 20
        }
    , Meetup
        { indexM = 5
        , presentations =
            [ Presentation
                { title = "Types and Higher Groupoids"
                , author = "<NAME>"
                , language = [En]
                , tags = [HoTT, Theory]
                , slides = NotYet
                , audio = Present "fpb-5/fpb-5.ogg"
                , player = NotYet
                }
            ]
        , time = Just $ read "2016-07-27 18:00:00 +02:00"
        , participants = Just 12
{'fraction_non_alphanumeric': 0.09481589652654636, 'fraction_numerical': 0.013977260874100344, 'mean_word_length': 1.9971866208190059, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1151433', 'n_tokens_mistral': 2889, 'n_tokens_neox': 2698, 'n_words': 945}