GithubHelp home page GithubHelp logo

sekunho / swoogle Goto Github PK

View Code? Open in Web Editor NEW
1.0 1.0 0.0 3.66 MB

A Star Wars search engine

Home Page: https://swoogle.sekun.dev

License: BSD 3-Clause "New" or "Revised" License

Nix 1.41% Haskell 96.39% CSS 0.16% JavaScript 1.19% Dockerfile 0.71% Shell 0.14%
swapi haskell

swoogle's Introduction

swapi

Haskell-CI License: MIT

In this package

  • /swapi-lib: Contains the necessary functions and data types for querying swapi.dev
  • /swoogle: Contains the GUI web search client (WIP)
  • /swoogle-tui: Contains the TUI search client (WIP)

swoogle

swoogle is a search client that uses the Star Wars API, specifically swapi-lib.

# Restart web server on change
# This one is so much faster than manually rebuilding!
ghcid --command stack ghci swoogle/Main.hs --test :main

# Have tailwind automatically parse and purge classes
tailwindcss --input assets/app.css \
  --output priv/static/assets/app.css \
  --config assets/tailwind.config.js \
  --watch

# Have esbuild automatically build `app.js`
esbuild assets/app.js --outfile=priv/static/assets/app.js --watch

swapi

swapi (found in the src directory) is a client library to interact with SWAPI (Star Wars API).

import qualified Swapi.Api as Api (getFilm)
import Swapi.Id (FilmId (FilmId))

main :: IO ()
main = do
  film <- Api.getFilm (FilmId 1)

  print film

Motivation

Hello! This is the first personal project I'm working on to study Haskell, free from following a book or tutorial as the main reference because it feels like I've been stuck in tutorial hell without any way out. I wanted to start with something relatively simple so I can study things from the ground up with practical experience. I'm also noting down some of the things I learned or realized in the README; something I realized I should be doing more often thanks to Fly.io.

I don't recommend using this as THE tutorial for this sort of thing because I'm just trying to piece things together like a caveman moments before fire was discovered.

Making this involves some of the commonly used Haskell libraries like aeson, containers, an HTTP client library I have not yet decided on, etc. and other basic Haskell concepts to be aware of โ€“ which makes it a good candidate for a starter project! Of course it doesn't require a deep dive in the aforementioned libraries; it's just enough to make things work.

My goals for this project are:

  • Explore the different libraries in the ecosystem
  • Try out the more common language extensions (new Haskell report when?)
  • Make things explicit. e.g instance signatures, kind signatures, deriving, etc.
  • Try out the different testing strategies

But of course I can't try out everything and I need to put a stop somewhere else I risk getting overwhelmed and back in "tutorial" hell again. I'll only read enough for what I need to know, and I'll stop there. So if you get mad at me for not using <INSERT_YOUR_FAVORITE_THING_HERE>, get a grip!

Will this be a video

Yeah! So far I've recorded most of each and every session that I worked on this. I'm still assessing if this should be a per episode video or just put the entire journey in one video. I don't have an editor so I usually do all the editing myself (which takes a lot of time). There's a lot of raw footage I'm gonna have to go through unfortunately.

Whenever it's ready, it'll be up on youtube.com/sekunho when I'm done. Subscribe to stay tuned! :)

Queryable resources

  • [ ] Root Not gonna bother with this one
  • People
    • Index
    • Search
    • View
  • Film
    • Index
    • Search
    • View
  • Starship
    • Index
    • Search
    • View
  • Vehicle
    • Index
    • Search
    • View
  • Species
    • Index
    • Search
    • View
  • Planet

List of improvements for swapi.dev

Although this is somewhat unrelated to the library itself, there are some changes I would like to make, should I get the free time to build a JSON api.

  • A collection of things is sometimes encoded as a comma delimited string instead of using an array

  • Numbers are encoded as strings just because the field could be an actual string like "n/a", or "none"

  • Inconsistent usage of units. e.g In Starship, it has a field called max_atmosphering_speed with the kilometer unit, and without. Both of which are numbers, just encoded as strings. What's the unitless number supposed to be?

  • api/<resource>/schema/ does not work

  • Starship: crew has a range value for one, and just a number for the others

  • Starship: length's number formatting is inconsistent

  • Starship: starship_class character case is inconsistent

  • Vehicle: length has an extra whitespace at the end. Why...

  • Vehicle: consumables, (specifically id 6), is just 0.

  • Vehicle: vehicle_class has classes that are the same but are formatted diferently. e.g id 70 and id 69 are both airspeeders, but one of them has a space in between.

  • Species: language's "Galactic basic" and "Galatic Basic"

  • Planet: gravity has a capitalized "N/A" rather than the usual lowercase

  • Planet: gravity is both denoted with standard and without. Might have to ask for clarifications.

These changes won't be implemented here, unless the swapi.dev maintainer decides to do the same as well. swapi is just meant to be compatible with swapi.dev.

I'm not so satisfied with the current database of SW stuff so I might just branch away from swapi.dev. I'd like to add descriptions to resources, or some trivia about them. Maybe I'll implement the improvements I've listed above. Who knows?

swoogle's People

Contributors

sekunho avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.