-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtutorial-notes.txt
More file actions
83 lines (64 loc) · 2.26 KB
/
tutorial-notes.txt
File metadata and controls
83 lines (64 loc) · 2.26 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
SETUP
========
how to install:
new app: stack new app-name yesod-sqlite
install ghc: stack setup
build files: stack build -j5
run webserver: stack exec app-name
ensure that yesod-auth, yesod-auth-oauth, yesod-auth-oauth2 added to .cabal
add library with version number to extra-deps in .yaml if error occurs
classes:
think of classes like interfaces from java
object implements the interface functions for a datatype
datatype can then be passed and class functions used
read more in book about classes/objects
adding a page:
create Test.hs file, handler called getTestR
add reference to hamlet with widgetFile test at the end
create hamlet html file templates/test.hamlet
add route referencing handler name with GET (/test testR)
add import Handler.Test to Application.hs
add handler to .cabal in library -> exposed-modules, Handler.Test
create github app:
user -> settings -> Oauth applications
create new app with url http://localhost:3000
callback url http://localhost:3000/auth/page/github/callback
adding github app keys in Foundation.hs:
clientId :: Text
clientId = "38ce4dc27f39e1985781"
clientSecret :: Text
clientSecret = "73fb0789eeb3c125eb553c87f9e1760134d3c095"
adding github oauth loading to Foundation.hs:
replace authPlugins app with [oauth2Github clientId clientSecret]
adding extra data to session:
ensure credsExtra data from OAUTH2 is in the session
use the code from yesod-auth-oauth2 sample file
put this in Foundation.hs under instance YesodAuth App (authenticate creds)
NOTES
=======
terminating recursion:
global: # of projects, # of calls
local: time based, attribute filter, time to live
structure:
hops decrementing, check for zero
projects users seen before are compared
d3 graph layout:
project in center, connected to users
possibly showing owner/member/user relationships
web structure:
web server, crawler, SQL database, threads, graph database.
different visualisation - add a search query
HASKELL
==========
haskell types:
Maybe = Nothing | Just x
Either = Left x | Right y (Left for error, right for no error)
getProject :: [Project] -> Int
[1,2,3] -> extract ProjectInfo
users <- extract ProjectMembership
map getUser (hops -1) users
getUser :: User -> IO()
projects <- extract UserInfo
[1,2,3] <- extract Projects
getUser 0 = return()
map GerProject projects