You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: tutorials/08_webapp.md
+19-5Lines changed: 19 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -132,6 +132,7 @@ There are several frameworks in Haskell (see [here](https://wiki.haskell.org/Web
132
132
-[Snap](http://snapframework.com)
133
133
-[Spock](https://www.spock.li)
134
134
-[Yesod](https://www.yesodweb.com)
135
+
-[IHP](https://ihp.digitallyinduced.com)
135
136
136
137
As you can see, there is quite an above-average offer of them. They mostly differ at the level of abstraction and scope: Scotty being relatively low-abstraction routing and middleware and Yesod being a complete solution including templating and persistence, everything on a high abstraction level. The choice depends on your preference and needs. As always, a higher abstraction means the system does a lot of job for yourself, you write fewer code, which means a higher effectiveness and less bugs. On the other hand, you may face a [leaky abstraction problem](https://blog.codinghorror.com/all-abstractions-are-failed-abstractions/) at some point.
137
138
@@ -219,6 +220,19 @@ main :: IO ()
219
220
main = warp 3000HelloWorld
220
221
```
221
222
223
+
### IHP (Integrated Haskell Platform)
224
+
225
+
[IHP](https://ihp.digitallyinduced.com/) is a batteries-included web framework for Haskell. It is designed to be easy to use and to provide a lot of functionality out of the box, including:
226
+
227
+
* A powerful type system that helps catch errors at compile time
228
+
* A built-in ORM (Object-Relational Mapping) for working with databases
229
+
* A templating engine for generating HTML
230
+
* A development server for testing and debugging
231
+
232
+
IHP is a good choice for developers who want to build web applications quickly and easily, without having to worry about the underlying details of web development. It is also a good choice for developers who want to take advantage of Haskell's powerful type system and functional programming features.
233
+
234
+
The architecture of IHP is based on the Model-View-Controller (MVC) pattern, which helps to keep the code organized and maintainable. The framework also provides a lot of built-in functionality for common web development tasks, such as authentication, authorization, and database migrations.
235
+
222
236
### Scotty
223
237
224
238
[Scotty](https://github.com/scotty-web/scotty) is another Haskell web framework inspired by Ruby's [Sinatra](http://sinatrarb.com), using [WAI](https://hackage.haskell.org/package/wai) and [Warp](https://hackage.haskell.org/package/warp) (a fast, light-weight web server for WAI applications). You can write your own application just with WAI (Web Application Interface), but Scotty provides you with abstractions from a low-level communication. Sadly, there is not so much documentation about Scotty, everything is just on [GitHub](https://github.com/scotty-web/scotty). Scotty uses primarily [Blaze HTML](https://hackage.haskell.org/package/blaze-html) for HTML "templates", however, as we explained, you may also integrate it with any templating library you like.
@@ -629,9 +643,9 @@ The application typically works with a simple entity such as a TODO item.
629
643
630
644
You will encounter:
631
645
632
-
*``Model`` = internal representation used in business logic
633
-
*``DTOs`` (DataTransferObjects) = types used for JSON input/output
634
-
*``Conversion functions`` = mapping between internal and external representations
646
+
*``Model`` = internal representation used in business logic
647
+
*``DTOs`` (DataTransferObjects) = types used for JSON input/output
648
+
*``Conversion functions`` = mapping between internal and external representations
635
649
636
650
### Model and Database
637
651
@@ -784,8 +798,8 @@ The homework to complete a simple web app is in repository [MI-AFP/hw08](https:/
*[adit.io: Making A Website With Haskell](http://adit.io/posts/2013-04-15-making-a-website-with-haskell.html)
789
803
*[24 Days of Hackage: blaze-html](https://ocharles.org.uk/blog/posts/2012-12-22-24-days-of-hackage-blaze.html)
790
804
*[Haskell web frameworks](https://wiki.haskell.org/Web/Frameworks)
791
805
*[Reddit: What Haskell web framework do you use and why? ](https://www.reddit.com/r/haskell/comments/332s1k/what_haskell_web_framework_do_you_use_and_why/)
0 commit comments