Commit ef0459afada6b0eb9ce1173078e6f37feed8fb8a

  • avatar
  • Ville Tirronen <ville.tirronen @j…u.fi> (Committer)
  • Fri Mar 23 20:37:08 EET 2018
  • avatar
  • Ville Tirronen <ville.tirronen @j…u.fi> (Author)
  • Fri Mar 23 20:37:08 EET 2018
Missing files
Cortex/src/Cortex/Date.hs
(34 / 0)
  
1{-# LANGUAGE DeriveGeneric #-}
2{-# LANGUAGE TemplateHaskell #-}
3{-# LANGUAGE DeriveAnyClass #-}
4{-#LANGUAGE OverloadedStrings#-}
5{-#LANGUAGE MultiParamTypeClasses#-}
6{-#LANGUAGE FlexibleInstances#-}
7module Cortex.Date where
8import GHC.Generics
9import Elm.Derive
10import Cortex.Elm
11import Dhall (Interpret)
12import Data.Time
13import Numeric.Natural
14import Data.Proxy
15import Data.Monoid
16import Data.Ord
17-- These are for interfacing with elm
18
19data Date = Date {day :: Natural, month :: Natural, year :: Natural} deriving (Generic,Show,Eq,Interpret)
20instance Ord Date where
21 compare a b = compare (year a) (year b) <>compare (month a) (month b) <> compare (day a) (day b)
22
23fromUTCTime :: UTCTime -> Date
24fromUTCTime (UTCTime t _) = let (y,m,d) = toGregorian t in Date (fromIntegral d) (fromIntegral m) (fromInteger y)
25
26toUTCTime :: Date -> UTCTime
27toUTCTime (Date d m y) = UTCTime (fromGregorian (fromIntegral y) (fromIntegral m) (fromIntegral d)) 0
28
29elmDateModule modname = elmDefns modname
30 [DefineElm (Proxy::Proxy Date)
31 ]
32
33
34deriveBoth Elm.Derive.defaultOptions ''Date
Cortex/src/Cortex/DeriveOptions.hs
(3 / 0)
  
1module Cortex.DeriveOptions where
2import Elm.Derive
3deriveOpts = Elm.Derive.defaultOptions{unwrapUnaryRecords=True}
ExerciseReturns/elm-review/page/TestPeerPage.html
(34 / 0)
  
1<html>
2
3 <head>
4 <meta charset="UTF-8">
5 <title>Title</title>
6 <!-- <link rel="stylesheet" href="style.css"> -->
7 <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.6.2/css/bulma.min.css">
8 </head>
9
10 <body>
11
12 <!-- Put the name of your app here (my sources place in `src` forder) -->
13 <div id="LoginComponent"></div>
14 <script type="text/javascript" src="https://functional-programming.it.jyu.fi/new-resources/Login.js"></script>
15 <script type="text/javascript">
16 var node = document.getElementById('LoginComponent');
17 var app = Elm.StandaloneLogin.embed(node,{loginManager:"https://functional-programming.it.jyu.fi/LoginManager/"});
18 app.ports.alert.subscribe(function(text) {
19 alert(text);
20 });
21 </script>
22 <h1>Testing the new uploader here!</h1>
23 <div id="main" style="display:flex;justify-content:center;"></div>
24 <script type="text/javascript" src="embed_peertask.js"></script>
25 <script>
26 var node = document.getElementById('main');
27 var app = Elm.Main.embed(node,{"exerciseStoreAt":"https://functional-programming.it.jyu.fi/tiea341/submissionSystem","revTaskID":"ExCurry_rev","taskID":"ExCurry"});
28 // Note: if your Elm module is named "MyThing.Root" you
29 // would call "Elm.MyThing.Root.embed(node)" instead.
30 </script>
31 </body>
32
33
34</html>