<commit_before>{-# LANGUAGE OverloadedStrings #-}

-- | Home/landing page.

module HL.View.Home where

import HL.View
import HL.View.Code
import HL.View.Home.Features
import HL.View.Template

-- | Home view.
homeV :: [(Text, Text, Text)] -> FromLucid App
homeV vids =
  skeleton
    "Haskell Language"
    (\_ _ -> return ())
    (\cur url ->
       do navigation False [] Nothing url
          header url
          br_ []
          br_ [class_ "hidden-xs hidden-sm"]
          br_ [class_ "hidden-xs hidden-sm"]
          try url
          br_ []
          community url vids
          features
          br_ []
          sponsors
          transition
          events)
    (\_ url ->
       scripts url
               [js_jquery_console_js
               ,js_tryhaskell_js
               ,js_tryhaskell_pages_js])

-- | Top header section with the logo and code sample.
header :: (Route App -> Text) -> Html ()
header url =
  div_ [class_ "header"] $
  (container_
     (row_ (do span12_ [class_ "col-sm-12 hidden-xs"]
                       (br_ [])
               span6_ [class_ "col-md-6"]
                      (div_ [class_ "branding"]
                            (do branding
                                summation))
               span6_ [class_ "col-md-6"]
                      (div_ [class_ "branding sample"]
                            (do tag
                                sample)))))
  where branding = do br_ [class_ "hidden-xs"]
                      img_ [src_ (url (StaticR img_haskell_logo_svg)), class_ "img-responsive"]
        summation =
          h4_ [class_ "summary"] "An advanced purely-functional programming language"
        tag = do br_ [class_ "visible-xs visible-sm"]
                 h4_ [class_ "tag"] "Declarative, statically typed code."
        sample =
          div_ [class_ "code-sample",title_ "This example is contrived in order to demonstrate what Haskell looks like, including: (1) where syntax, (2) enumeration syntax, (3) pattern matching, (4) consing as an operator, (5) list comprehensions, (6) infix functions. Don't take it seriously as an efficient prime number generator."]
               (haskellPre codeSample)

-- | Code sample.
-- TODO: should be rotatable and link to some article.
codeSample :: Text
codeSample =
  "primes = filterPrime [2..] \n\
  \  where filterPrime (p:xs) = \n\
  \          p : filterPrime [x | x <- xs, x `mod` p /= 0]"

-- | Try Haskell section.
try :: (Route App -> Text) -> Html ()
try _ =
  div_ [class_ "pattern-bg"] $
    container_ $
      do row_ (span12_ [class_ "col-sm-12"]<commit_msg>Change subhead copy underneath the Haskell logo<commit_after>{-# LANGUAGE OverloadedStrings #-}

-- | Home/landing page.

module HL.View.Home where

import HL.View
import HL.View.Code
import HL.View.Home.Features
import HL.View.Template

-- | Home view.
homeV :: [(Text, Text, Text)] -> FromLucid App
homeV vids =
  skeleton
    "Haskell Language"
    (\_ _ -> return ())
    (\cur url ->
       do navigation False [] Nothing url
          header url
          br_ []
          br_ [class_ "hidden-xs hidden-sm"]
          br_ [class_ "hidden-xs hidden-sm"]
          try url
          br_ []
          community url vids
          features
          br_ []
          sponsors
          transition
          events)
    (\_ url ->
       scripts url
               [js_jquery_console_js
               ,js_tryhaskell_js
               ,js_tryhaskell_pages_js])

-- | Top header section with the logo and code sample.
header :: (Route App -> Text) -> Html ()
header url =
  div_ [class_ "header"] $
  (container_
     (row_ (do span12_ [class_ "col-sm-12 hidden-xs"]
                       (br_ [])
               span6_ [class_ "col-md-6"]
                      (div_ [class_ "branding"]
                            (do branding
                                summation))
               span6_ [class_ "col-md-6"]
                      (div_ [class_ "branding sample"]
                            (do tag
                                sample)))))
  where branding = do br_ [class_ "hidden-xs"]
                      img_ [src_ (url (StaticR img_haskell_logo_svg)), class_ "img-responsive"]
        summation =
          h4_ [class_ "summary"] "A purely functional, advanced programming language"
        tag = do br_ [class_ "visible-xs visible-sm"]
                 h4_ [class_ "tag"] "Declarative, statically typed code."
        sample =
          div_ [class_ "code-sample",title_ "This example is contrived in order to demonstrate what Haskell looks like, including: (1) where syntax, (2) enumeration syntax, (3) pattern matching, (4) consing as an operator, (5) list comprehensions, (6) infix functions. Don't take it seriously as an efficient prime number generator."]
               (haskellPre codeSample)

-- | Code sample.
-- TODO: should be rotatable and link to some article.
codeSample :: Text
codeSample =
  "primes = filterPrime [2..] \n\
  \  where filterPrime (p:xs) = \n\
  \          p : filterPrime [x | x <- xs, x `mod` p /= 0]"

-- | Try Haskell section.
try :: (Route App -> Text) -> Html ()
try _ =
  div_ [class_ "pattern-bg"] $
    container_ $
      do row_ (span12_ [class_ "col-sm-12"]
{'fraction_non_alphanumeric': 0.11029976940814758, 'fraction_numerical': 0.008455034588777863, 'mean_word_length': 1.7849117174959872, 'pattern_counts': {'":': 0, '<': 5, '<?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': '4583609', 'n_tokens_mistral': 1599, 'n_tokens_neox': 1523, 'n_words': 494}