Sridhar Ratnakumar
83302865e1
StaticRoute: reduce one argument in staticRouteUrl
2022-07-02 17:16:19 -04:00
Sridhar Ratnakumar
a1c7932c99
GenericRouteOpt: add defaults
2022-07-02 17:16:02 -04:00
Sridhar Ratnakumar
505168f783
subRoutesIso doesn't havae to be a class method
2022-07-02 14:11:41 -04:00
Sridhar Ratnakumar
192760d689
garnix: disable m1 shell (odd failure)
2022-07-02 11:34:52 -04:00
Sridhar Ratnakumar
05d410670f
StaticRoute: derive Generic
2022-07-02 11:15:04 -04:00
Sridhar Ratnakumar
111d589122
Add GenericRoute r opts
for customizing DerivingVia of routes ( #110 )
...
* Prototype DerivingVia type-level config
* Begin adding comments
* garnix note in README
* Port Generic.Exmaple to use newstyle
* Open the type-class, so users can customize deriving themselves
* Add GenericRouteOpts
* Expand documentation (API)
* cleanup exports, and naming
2022-07-02 11:07:49 -04:00
Sridhar Ratnakumar
1d67c1b85b
Revert "GHC 9.2.2 -> 9.2.3 ( #109 )" ( #112 )
...
This reverts commit 1959f780af
.
2022-07-02 09:58:11 -04:00
Sridhar Ratnakumar
6010ef0acc
Build devShell in CI ( #111 )
...
* garnix: Add M1 shell
* fix shel
2022-07-02 09:46:17 -04:00
Sridhar Ratnakumar
1959f780af
GHC 9.2.2 -> 9.2.3 ( #109 )
2022-07-01 16:04:00 -04:00
Sridhar Ratnakumar
760fd79310
Replace Coercible with GIsomorphic
2022-07-01 12:46:21 -04:00
Sridhar Ratnakumar
672467dea8
refactor: split Sub.hs
2022-07-01 12:11:03 -04:00
Sridhar Ratnakumar
6f24227c65
refactor: split RGeneric
2022-07-01 11:54:56 -04:00
Sridhar Ratnakumar
25732cd4f0
HasSubModels
automatic deriving ergonomics (#108 )
...
`HasSubModels` can now be derived generically, or derived "via" WithSubModels. Just like `HasSubRoutes`. In the case of ambiguities use deriving via to explicitly specify the field name (see Ex04_Multi).
2022-06-30 19:32:15 -04:00
Sridhar Ratnakumar
0b011338c6
Add StaticRoute ( #79 )
...
From https://github.com/fpindia/fpindia-site/blob/master/src/FPIndia/StaticRoute.hs
2022-06-29 23:25:46 -04:00
Sridhar Ratnakumar
62f0d9adf1
Greatly strip down Encoder.hs exports
...
`prismRouteEncoder` can be used to create the removed encoders.
2022-06-28 21:11:27 -04:00
Sridhar Ratnakumar
2835d8efc8
Split Encoder module
2022-06-28 20:59:11 -04:00
Sridhar Ratnakumar
945a9f9eed
Drop superflous encoder functions
...
They have questionable value given that the user can use mapRouteEncoder
directly.
2022-06-28 20:55:20 -04:00
Sridhar Ratnakumar
bda8dff448
Demystify RouteEncoder; drop CtxPrism separation
2022-06-28 20:49:32 -04:00
Sridhar Ratnakumar
993c175df0
Fix bugs in Ex03
2022-06-28 18:01:26 -04:00
Sridhar Ratnakumar
69e4bf225f
Add unit route
...
Simplifies the most trivial program further.
2022-06-28 17:40:48 -04:00
Sridhar Ratnakumar
bbff7368d2
Cleanup
2022-06-28 17:34:51 -04:00
Sridhar Ratnakumar
98deb1dc90
Avoid undefined
2022-06-28 17:22:12 -04:00
Sridhar Ratnakumar
1931e5b0ee
Ex03: slug-based URLs; and add StringRoute abstraction
2022-06-28 16:31:18 -04:00
Sridhar Ratnakumar
084e969668
Merge pull request #93 from srid/multigeneric
...
Rewrite generic deriving based on `Ema.Multi`
2022-06-28 12:27:44 -04:00
Sridhar Ratnakumar
6177b99e88
Require the user to import Ema.Route.Generic explicitly if they want generic deriving
2022-06-28 11:23:31 -04:00
Sridhar Ratnakumar
494875a1af
Show friendly type-error if user tries to derive HasSubModels on non-const sub models
2022-06-28 11:17:52 -04:00
Sridhar Ratnakumar
a2d6ecfb48
Remove WithConstModel. It is redundant, because WithModel works.
2022-06-28 11:16:55 -04:00
Sridhar Ratnakumar
bb115e3a61
Re-organize CPP to satisfy fourmolu (treefmt)
2022-06-28 11:05:13 -04:00
Sridhar Ratnakumar
d5f082c316
Disable SubRoute generics if on GHC <9.2
...
Resolves #99
2022-06-28 11:01:19 -04:00
Sridhar Ratnakumar
3fa1d5d15f
Refactor
2022-06-28 10:53:29 -04:00
Sridhar Ratnakumar
858d9ba769
Merge pull request #102 from srid/multigeneric-siteOutput-noenc
...
`siteOutput`: pass `Prism'` directly instead of `RouteEncoder`
2022-06-28 09:33:20 -04:00
Sridhar Ratnakumar
6b194220ab
remove encodeRoute/decodeRoute (redundant)
2022-06-28 09:30:43 -04:00
Sridhar Ratnakumar
9699fd6443
siteOutput: pass route prism directliy
2022-06-28 09:21:42 -04:00
Sridhar Ratnakumar
e950c66800
Ex03: add extra field to model (subroute unrelated)
2022-06-28 09:04:40 -04:00
Sridhar Ratnakumar
0349c2612e
misc: Update comments
2022-06-28 09:01:42 -04:00
Sridhar Ratnakumar
5ff196591a
Export generic interface by default
2022-06-27 19:44:59 -04:00
Sridhar Ratnakumar
baf9b45b09
Move Multi.hs to route lib package
2022-06-27 19:35:07 -04:00
Sridhar Ratnakumar
5a95286043
reorg: move generic code under Ema.Route.Generic
2022-06-27 19:33:48 -04:00
Sridhar Ratnakumar
5e465e592f
reorg: rename to FileRoute/FolderRoute
2022-06-27 19:30:31 -04:00
Sridhar Ratnakumar
4004647873
EmaSite: remove default siteInput (confusing)
2022-06-27 19:10:08 -04:00
Sridhar Ratnakumar
0dc0905e2f
Remove old generics code
2022-06-27 19:09:54 -04:00
Sridhar Ratnakumar
f6f3ffea5c
Port all examples to new generics
2022-06-27 18:52:27 -04:00
Sridhar Ratnakumar
5f08f3ec15
refactor: group constraints
2022-06-27 13:08:10 -04:00
Sridhar Ratnakumar
f6cb786797
Ex03_Store: override sub-routes to remove extraneous /product/ and /category/ in URL
2022-06-27 12:31:29 -04:00
Sridhar Ratnakumar
c8e5f31b3d
Add WithSubRoutes
for DerivingVia
...
Due to coercion issues, we must move subRoutesIso to outside of
type-class.
2022-06-27 12:28:23 -04:00
Sridhar Ratnakumar
ddf81718e5
Port Ex03_Store.hs to use motley generics (in its current state)
...
Looks good except,
- Too much deriving lines (can we merge type classes?)
- MotleyModel has to be derived manually at top-level. But since there
is no ambiguity, we could in theory derive it automatically.
2022-06-27 12:08:03 -04:00
Sridhar Ratnakumar
18b8044e5b
SubModels ~ RouteModel; so remove it.
2022-06-27 12:00:38 -04:00
Sridhar Ratnakumar
fd1ecc48bc
rename: Motley* -> HasSub*
...
Over time it became clear that these typeclasses really capture the
nature of sub-routes and sub-models respectively. So name them as such.
2022-06-27 11:56:22 -04:00
Sridhar Ratnakumar
c589c615d5
Drop route encoder argument from siteInput ( #100 )
2022-06-26 20:29:00 -04:00
Sridhar Ratnakumar
2db4b0ac2a
Refactor
2022-06-26 16:14:53 -04:00