This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Main where | |
main :: IO () | |
main = do | |
putStrLn "My second ever gist!" | |
-- You could add another line here: | |
putStrLn "The end!" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Extras( | |
-- * Functions | |
calculateEverything | |
) | |
where | |
calculateEverything :: () -> Int | |
calculateEverything _ = 42 | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let cfg = pkgs : { | |
packageOverrides = pkgs : rec { | |
# | |
# 'localHaskellPackages' contains not only the packages which we're explicitly | |
# adding / modifying below, but also versions of the normal 'haskellPackages' | |
# which make use of our modified packages instead of the default versions. | |
# | |
# At the time of writing, we only have additions rather than overrides per-se, | |
# but this will probably be a useful feature in the future. | |
# |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- | This is a variant of 'simpleList' which manages a current selection. | |
-- The 'Bool' accepted by the rendering function indicates whether the | |
-- element in question is currently selected or not. | |
selectList :: forall t m a i . (Eq i, MonadWidget t m) => | |
(a -> i) -> Dynamic t [a] -> (Dynamic t (a, Bool) -> m (Event t i)) -> m (Event t i) | |
selectList getItem ds fn = mdo | |
let ev :: Event t i | |
ev = switch $ fmap leftmost $ current evs | |
markSel :: [a] -> Maybe i -> [(a,Bool)] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
data AppState = AppState { | |
_asFeeds :: M.Map BordersFeed BFeedState, | |
_asSelectedFeed :: Maybe BordersFeed | |
} | |
$(makeLenses ''AppState) | |
data AppEvent = FeedFetched (BordersFeed, String) | |
| FeedSelected BordersFeed |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Compute URL for opening new tab with the corresponding new post in it | |
let npUrl np = "/postinfo?seq=" <> T.pack (show $ newSeq np) <> "&owner=" <> webAdminToolDevice | |
webAdminToolDevice = "WebAdminTool" -- FIXME - should share code with Borders.Base.Model.Core | |
eurl :: Event t T.Text | |
eurl = fmapMaybe (fmap npUrl . snd) (enpresult :: Event t (BordersNewPost, Maybe BordersNewPostResult)) | |
durl <- holdReset eurl (() <$ updated darticle) :: m (Dynamic t (Maybe T.Text)) | |
--dynText =<< mapDyn (("durl:"<>) . show) durl |